I have a problem with maven. I wanted to add dependency to embedded Glassfish. I added an entry to pom.xml, containing a fragment copied from internet:
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1</version>
</dependency>
However, mvn package prints an error.
Access denied to: http://repository.jboss.org/maven2/org/glassfish/extras/glassfish-embedded-all/3.1/glassfish-embedded-all-3.1.pom -> [Help 1]
What is wrong?
Did you pointed to the right repository at you pom.xml file?
Insert this at the end of it, just before the last </project> tag:
<repositories>
<repository>
<id>glassfish-releases</id>
<url>http://download.java.net/maven/glassfish</url>
</repository>
</repositories>
Connecting to http://repository.jboss.org/maven2 per HTTP throws an 403 Forbidden error, as it is outdated.
This SO question has:
http://maven.glassfish.org/content/groups/glassfish
as the new URL.
Related
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.
I'm trying to use docker-compose-rule to run docker-compose files in junit integration tests.
I use the following dependency in my pom.xml file:
<dependency>
<groupId>com.palantir.docker.compose</groupId>
<artifactId>docker-compose-rule-core</artifactId>
<version>0.32.0</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/com.palantir.docker.compose/docker-compose-rule-junit4 -->
<dependency>
<groupId>com.palantir.docker.compose</groupId>
<artifactId>docker-compose-rule-junit4</artifactId>
<version>0.32.0</version>
</dependency>
but for some reason the artifact is not found by maven (for none of the available versions).
As far as I can say, the artifact is found in the jcenter as shows in bintray.
It also exists on maven repository.
Can someone please tell why can't I use these libraries?
Alternatively, can I reference maven to take the library from a specific url with a specific jar file, for example from github, or from here?
According to mvnrepository, the jar you are looking for is not in the maven default Central repository, but is in the Palantir repository. You can add
<repositories>
<repository>
<id>Palantir</id>
<url>https://dl.bintray.com/palantir/releases/</url>
</repository>
</repositories>
into your pom.xml, and try again.
I was trying to resolve jPOS:2.0.8 version but it is failing because not able to resolve dependency for com.sleepycat.je:je:7.0.6.
<dependency>
<groupId>com.sleepycat</groupId>
<artifactId>je</artifactId>
<version>7.0.6</version>
<scope>compile</scope>
</dependency>
I have check the maven repository and com.sleepycat.je lower version is available there.
http://repo.maven.apache.org/maven2/com/sleepycat/je/
http://repo.maven.apache.org/maven2/org/jpos/jpos/2.0.8/jpos-2.0.8.pom
Edit
Even i have added maven { url 'download.oracle.com/maven'; } in build.gradle but still not resolving the dependency.
Edit :
I am getting below error
What went wrong: Could not resolve all dependencies for configuration ':compileClasspath'.
Could not resolve com.sleepycat:je:7.0.6. Required by:
org.jpos:jpos:2.0.8
Could not resolve com.sleepycat:je:7.0.6.
Could not get resource 'http://repo.maven.apache.org/maven2/com/sleepycat/je/7.0.6/je-7.0.6.pom'.
Could not GET 'http://repo.maven.apache.org/maven2/com/sleepycat/je/7.0.6/je-7.0.6.pom'.
Connect to repo.maven.apache.org:80 [repo.maven.apache.org/151.101.20.215] failed: Connection timed out:
connect
Could not resolve com.sleepycat:je:7.0.6.
Could not get resource 'http://jpos.org/maven/com/sleepycat/je/7.0.6/je-7.0.6.pom'.
Could not GET 'http://jpos.org/maven/com/sleepycat/je/7.0.6/je-7.0.6.pom'.
Connect to jpos.org:80 [jpos.org/52.7.83.125] failed: Connection timed out: connect
Could not resolve com.sleepycat:je:7.0.6.
Could not get resource 'http://download.oracle.com/maven/com/sleepycat/je/7.0.6/je-7.0.6.pom'.
Could not GET 'http://download.oracle.com/maven/com/sleepycat/je/7.0.6/je-7.0.6.pom'.
Connect to download.oracle.com:80 [download.oracle.com/23.50.225.25, download.oracle.com/23.50.225.9]
failed: Connection timed out: connect
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
sleepycat version 7.0.6 is not in the main maven repo, you need to add oracle maven repo to your pom:
<repositories>
<repository>
<id>oracleReleases</id>
<name>Oracle Released Java Packages</name>
<url>http://download.oracle.com/maven</url>
<layout>default</layout>
</repository>
</repositories>
This goes outside the dependencies tag, directly under de project tag.
Add this code in pom.xml
<repositories>
<repository>
<id>oracle</id>
<name>Oracle repo</name>
<url>http://download.oracle.com/maven</url>
</repository>
</repositories>
Or You could ignore sleepy cat dependency
<dependency>
<groupId>org.jpos</groupId>
<artifactId>jpos</artifactId>
<version>2.1.0</version>
<exclusions>
<exclusion>
<groupId>com.sleepycat</groupId>
<artifactId>je</artifactId>
</exclusion>
</exclusions>
</dependency>
Just use jpos 1.9.2. Thats the last stable release eitherway
UPDATE: So I just want to point out that before I submitted this question, I attempted the solution that I've seen on similar stackoverflow questions such as this one. It was still giving me runtime errors, so I decided to write this question. mvn dependency:tree is what I was looking for so thanks #dunni. With mvn dependency:tree, I was able to find the actual name of the jersey dependency that was breaking my application and updated the exclusion by changing it from:
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
To:
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</exclusion>
</exclusions>
This works now.
For the longest time, I've been working on this Spring Jersey REST application using 1 internal company repository. Now, I found out that a library I need to use only exists in a 2nd internal company repository. I updated my .m2 -> settings.xml configuration to add the reference to the new repo like so:
<settings>
<mirrors>
<mirror>
<id>internal-repository1</id>
<name>name</name>
<url>http://repo1.company.com/repositories/</url>
<mirrorOf>*, !repo2</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>profile</id>
<repositories>
<repository>
<id>repo1</id>
<name>repo1</name>
<url>http://repo1.company.com/repositories/</url>
</repository>
<repository>
<id>repo2</id>
<name>repo2</name>
<url>http://repo2.company.com/respositories/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>profile</activeProfile>
</activeProfiles>
</settings>
This works. I can see in the System.out that it attempts to download the repo2 exclusive dependency from repo1.company.com/repositories/. It fails, then it attempts to download it from repo2.company.com/repositories and it succeeds. The build continues, and eventually tomcat gets started up on localhost:8080 and everything is fine.
The problem is, whenever I try to access any of my Jersey REST endpoints I've set up, I get the runtime error mentioned in the question title:
ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[my.package.name]
- Allocate exception for servlet my.package.name.JerseyConfig
java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
I know for a fact that the issue lies somewhere in this new dependency I'm trying to use. When I comment out the dependency in my pom.xml, and re run the application, everything works fine. All REST endpoints are functional. Uncomment the dependency, re-run the application, and try to access my REST endpoints, and I get the above error.
How do I go about finding out why this dependency is breaking my Jersey application at runtime?
By Seeing the error I can guess that there are some conflicts in jar files Please check if you have a both a JAX-RS 1 and JAX-RS 2 jar on the classpath. Jersey 2 uses JAX-RS 2 (javax.ws.rs-api-2.0.1.jar), but if you have the jsr311-api.jar also, which is JAX-RS 1, there is a javax.ws.rs.core.Application in each jar. But the jsr311-api Application doesn't have the method getProperties().
I got the same Exception, altough it was on different dependencies:
I got to change my sql driver version:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre8</version>
</dependency>
Before, I was using version 6.1.0.jre8. Here I got the clue.
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.