Running Maven for Gephi - maven

I would like to create a plugin for Gephi but I got an error when running Maven and the project is not supported since 4 years... I already posted my question as an issue but I think no one will answer me now.
I forked the git and tried to follow instructions in the README to create my own plugin, but when I run this command :
mvn clean package
I constantly get this error :
[ERROR] Failed to execute goal on project gephi-plugins: Could not resolve dependencies for project org.gephi:gephi-plugins:pom:0.9.2: Failed to collect dependencies at org.gephi:gephi:tar.gz:linux:0.9.2 -> org.netbeans.cluster:platform:pom:RELEASE82: Failed to read artifact descriptor for org.netbeans.cluster:platform:pom:RELEASE82: Could not transfer artifact org.netbeans.cluster:platform:pom:RELEASE82 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [netbeans (http://bits.netbeans.org/nexus/content/groups/netbeans/, default, releases)] -> [Help 1]
I'm new with Maven and issues #77 and #214 didn't help me, I just followed instructions in the README file.
I followed the link given by the error and a blank page with this text appeared :
Repository decommissioned. Please refer to https://netbeans.apache.org/about/oracle-transition.html for more information.
And after clicking the link above, I thought this part was interesting :
As of March the 6th, 2021, we’ll be standing on our own feet, and all the Apache NetBeans Project source and convenience binaries will be hosted by the Apache Infra Team.
And then, a "new" code for handling netbeans repository
<build>
<repositories>
<repository>
<id>netbeans</id>
<name>NetBeans</name>
<url>http://netbeans.apidesign.org/maven2/</url>
</repository>
</repositories>
<build>
Is that possible that the pom.xml file is not up to date ? Or am I missing something ?
I spoke with someone who already used Maven at the office and he said that none of gephi repositories are working with Maven, all of them display the error.
Thanks for the help !

Finally the solution was quite simple :
The NetBeans repositories have indeed changed, so, in modules/pom.xml :
<repository>
<id>netbeans</id>
<name>NetBeans</name>
<url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
We have to change the <url> tag to :
<url>http://netbeans.apidesign.org/maven2/</url>
I did that and it didn't work because my Maven version didn't support non secure url repositories (http) and I need to add a "s" in order to make it works.
<url>https://netbeans.apidesign.org/maven2/</url>
For a reason that I don't know, the project still not compile and we have to go to the parent pom.xml on the root folder and add the same NetBeans repository than above.
After doing that it compile.
I don't know if this is normal, but I'm new to Maven and I didn't know : if you want to use some gephi packages in your module (and wou want) you have to add them into module/YourModule/pom.xml in the <dependencies> tag ! Like that :
<dependencies>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>layout-api</artifactId>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>graph-api</artifactId>
<version>0.9.2</version>
</dependency>
<!-- ... -->
</dependencies>
I tested it with the GridLayout plugin from the Gephi Plugins Bootcamp and it worked.

Related

Maven repository that sometimes works

I hosted a java project on github.
The project is located here.
The project is really just a java library, and I wanted to create a maven repository for it. Because this is tricky, I followed a guide which explained me which project structure to follow. He applies a trick: create a 2nd branch named "repository". As you can see the jar files are in there.
That all went well, I made my first build, and then I created a java "Hello World" project to test if I could use this new maven dependency. So, I created a pom file with a dependency:
<dependency>
<groupId>brugo</groupId>
<artifactId>brugo</artifactId>
<version>0.1.0</version>
</dependency>
And to tell maven where to find this dependency, I added this one:
<repositories>
<repository>
<id>brugo</id>
<url>https://github.com/brugo/brugo/raw/repository/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
The good thing: sometimes it works.
The bad thing: sometimes it does not work.
And I am trying to find out what could be wrong. This is what IntelliJ looks like when things go wrong:
And I've seen this error message showing up:
[ERROR] Failed to execute goal on project xxx:
Could not resolve dependencies for project xxx:
Could not find artifact brugo:brugo:jar:0.1.0 in
brugo (https://github.com/brugo/brugo/raw/repository/) -> [Help 1]
I tried an mvn clean install -U several times, but without success.
I had the same problem on a different computer yesterday, then suddenly I got it to work without really knowing how.
Special thanks to #wargre for pointing me in this direction.
It's indeed easier (and more convenient) to set it up to be directly in the central maven repository.
http://central.sonatype.org/pages/ossrh-guide.html explains all the required steps. Here follows a summary.
First release:
Create a JIRA account and a project
Add plugins to the pom.xml file
Add more meta to the pom.xml
Download/install GPG and create keys
Create a settings.xml which contains your credentials.
Run mvn clean deploy
Verify the result in the staging repository
Release when happy, drop and retry while unsatisfied.
Post a comments on the JIRA ticket
Admire the result in the maven central repository.
Consecutive releases:
Update the version number in pom.xml
Run mvn clean deploy
Release (manual/automatic)

Maven dependencies in local REPO have .lastUpdated extension

When I try to to install maven project in local repository, I notice that pom and jar files have .lastUpdated extension. Because of this issue I cannot build my project which depends on it.
Could you please explain why it happens?
I've found the answer here :
When an artifact is unable to be downloaded, Maven 3 caches this result for future reference in the "~/.m2/repo/.../.lastUpdated" file. For "not found" situations, it seems that the HTTP code could be used to more granularly re-attempt retrieval rather than just cache the failure.
For example, for any 404, I agree, the result should cache the failure and require a -U to attempt to retrieve it again. However, for 400, 500, 501, 502, 503, 301, 302 (what's the Maven behavior for 3xx today?) I think the resolution engine should try to re-retrieve the artifact each time. With those error codes, it seems more likely a config issue or brief network hiccup, not one of the file being absent from that repo. However, that brief network hiccup has longstanding cache implications in that the file is never attempted to be retrieved again.
It also can happen when you refer to the artifact which is listed under Maven Repository but is not there physically. E.g., the following Exasol artifact is listed under Maven Repository, but there's a small side note which tells that:
Note: this artifact i[s] located at Exasol repository
(https://maven.exasol.com/artifactory/exasol-releases/)
This means that you need to separately add another repository (in this case Exasol) as a source in your pom.xml file:
<!-- add the dependency as mentioned in maven website -->
<dependencies>
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-jdbc</artifactId>
<version>6.2.1</version>
</dependency>
</dependencies>
<!-- add the actual repository which unfortunately isn't mentioned in maven website -->
<repositories>
<repository>
<id>maven.exasol.com</id>
<url>https://maven.exasol.com/artifactory/exasol-releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Should I write repositories in my pom.xml?

I am new to Maven. If I start new project with Maven, should I know any repository URLs for it to work?
For example, this Hibernate tutorial http://docs.jboss.org/hibernate/core/3.3/reference/en/html/tutorial.html says about how to create a sample project with pom.xml text. But this pom.xml does not contain any repositories.
So, my m2eclipse plugin says, for example Project build error: 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing., for all dependency tag in pom.xml
Is this because of repositories absence?
Where to know repositories URLs? Is there one big repository? Why doesn't it included by default?
UPDATE 1
It is said here, that Maven should use "central" repository by default: http://maven.apache.org/guides/introduction/introduction-to-repositories.html
I have searched there for hibernate-code artifact and found it. So, this artifact IS in central repository. By my maven says dependency not found. Hence it doesn't use it's central repository. Why?
Apparently your Hibernate dependency is missing <version> tag:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.9.Final</version> <!-- this line is missing -->
</dependency>
Note that you don't have to specify version of dependencies previously declared in <dependencyManagement>.
Old answer:
Every build script (not only with Maven) should be reproducible and independent from environment. Standard pom.xml (called super pom), which every pom.xml inherits from, already defines main Maven central repository:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
You don't have to define this repository, and you don't have to define any others if all your dependencies are there. On the other hand if you are using some external repositories, you must add them to pom.xml, so that every developer is always able to build.
The bottom line is: if you can build the project having a completely empty repository, your pom.xml is fine.
It's not advisable to define repositories in POM files as that causes a lot of issues (Maven will search those repositories for ANY artifact even the ones available at Central, poor portability, ...)
Best approach: Setup a repository manager (Artifactory, Nexus) and edit your settings.xml file to use the repo manager as a mirror.
Second best approach: Define the required repositories in your settings.xml file, not in your pom.xml files.
Repositories in poms is a bad idea.

How can i use SVN as Maven Repository

I am working on project which has multiple dependencies. Most of the dependencies are available at our centralized maven repository. My project includes some JARs which only specific to my application and unavailable at our Maven repo. Due to some policy/restriction i cant deploy that jars to our maven repository.
When i install these jars in my local repository(i.e.UserHome/.m2/repository) and compile the code its working fine.
Now i want these dependencies in SVN so that we can build the application package using Continuum.(We cant refer local dependency from Continuum server.)
Just to achieve these i copied the locally installed dependency from .m2/repository and committed it in SVN. Then i declared repository in pom.xml like..
<repositories>
<repository>
<id>repo.pu</id>
<name>repo.pu</name>
<url>https://URL/migration2/APP1/src/main/lib/</url>
<layout>default</layout>
</repository>
</repositories>
Now to use dependency from above repo i added code like...
<dependencies>
<dependency>
<groupId>repo.pu</groupId>
<artifactId>Ptestval</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
When i type mvn verify i am getting the below error..
[ERROR] Failed to execute goal on project APP1: Could not resolve dependencies f
or project fileservices.migration2:APP1:jar:1.0: Failed to collect dependencies
for [repo.pu:Ptestval:jar:1.0 (compile)]: Failed to read artifact descriptor for
repo.pu:Ptestval:jar:1.0: Could not transfer artifact repo.pu:Ptestval:pom:1.0
from/to repo.pu (https://URL/migration2/APP1/src/main/lib/): Access denied to:
https://URL/migration2/APP1/src/main/lib/repo/pu/Ptestv
al/1.0/Ptestval-1.0.pom -> [Help 1]
Could you please someone help me to resolve these issue?
EDIT: I created a repository like ..
<repositories>
<repository>
<id>repo.pu</id>
<name>repo.pu</name>
<url>https://SVNUserName:SVNPassword#SVN_URL/BaseProj/ProjA/src/main/lib</url>
<layout>default</layout>
</repository>
</repositories>
This technique works perfectly at my Personal laptop. Maven downloads the listed dependency from repo.
But when tries to use the same in my project on company network it is not working .. It gives the same error which i was getting before using this approach.
Can anyone help me please? What would be problem? Is it a network issue?
Set up a repository manager like Nexus and don't abuse Subversion for something it was not designed for. This is unfortunately done in Google Code.
You must configure your project to use wagon-scm.
See http://maven.apache.org/wagon/wagon-providers/wagon-scm/usage.html

Maven can't resolve the dependency it just found

Maven must be losing its mind.
I added a dependency using Netbeans Add Dependency dialog. I searched for jax-rs-ri. It updated the index from central and showed several versions of jax-rs-ri. I selected 1.9.1 and it added this to the pom.xml:
<dependency>
<groupId>com.sun.jersey.ri</groupId>
<artifactId>jax-rs-ri</artifactId>
<version>1.9.1</version>
</dependency>
Looks right, but when I build I get the following error:
Failed to execute goal on project reply-to.test-web:
Could not resolve dependencies for project jms:reply-to.test-web:war:1.0-SNAPSHOT:
Could not find artifact com.sun.jersey.ri:jax-rs-ri:jar:1.10-b03 in
central (http://repo1.maven.org/maven2) -> [Help 1]
I've also tried changing the repository the following with the same results:
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories>
This was working earlier today. Did something just get broken with Maven?
In these cases it's worth to check the local repository (usually c:\Users\<username>\.m2\repository\com\sun\jersey\ri\jax-rs-ri or /home/<username>/.m2/repository/com/sun/jersey/jax-rs-ri) and Central:
http://search.maven.org/#artifactdetails|com.sun.jersey.ri|jax-rs-ri|1.9.1|pom
(The important part now is the "Available Downloads" table.)
So, there isn't any jar file just a zip (and the POM). You should use <type>zip</type> in your dependency like this:
<dependency>
<groupId>com.sun.jersey.ri</groupId>
<artifactId>jax-rs-ri</artifactId>
<version>1.9.1</version>
<type>zip</type>
</dependency>
Since it's a zip maybe you want to unpack it. This answer could help: Unzip dependency in maven
Please note that 1.9.1 is not the latest jax-rs-ri version and your Maven uses 1.10-b03. If you want to force it to use 1.9.1 you have to use <version>[1.9.1]</version> inside the dependency tag.

Resources