2

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?

palacsint
  • 28,416
  • 10
  • 82
  • 109
Dean Schulze
  • 9,633
  • 24
  • 100
  • 165

1 Answers1

6

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.

Community
  • 1
  • 1
palacsint
  • 28,416
  • 10
  • 82
  • 109
  • Adding zip fixed it. Without it I still get Downloading: http://download.java.net/maven/2/com/sun/jersey/ri/jax-rs-ri/1.9.1/jax-rs-ri-1.9.1.jar Downloading: http://repo1.maven.org/maven2/com/sun/jersey/ri/jax-rs-ri/1.9.1/jax-rs-ri-1.9.1.jar so it looks like mvn finds the .jar files. Strange. – Dean Schulze Oct 25 '11 at 12:57
  • It downloads the zip, believe me :) The zip contains the jars but you have to unpack it if you'd like to use them. – palacsint Oct 25 '11 at 13:27