maven unable to download jar files from repositories, doesn't recognize already present jar files
I'm new to Maven and m2eclipse, and have been trying to run the main pom.xml file as a maven install for the first time, but it's just not working right. It tries to download some jar files (from both public and private repositori开发者_开发问答es), but can't seem to access the repositories.
The code was written by someone else at my company and works fine on other computers, so I don't think it's that, it's more likely a problem with how I have eclipse, maven, and m2eclipse set up. I'll post a sample of the pom.xml anyways
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
...
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
The error associated with this specific chunk is:
Failed to execute goal on project webservice-service-ejbs: Could not resolve dependencies for project com.lexi:webservice-service-ejbs:ejb:2.1: Failed to collect dependencies for [...] com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4 (test)
So after wrangling with this for a bit I got fed up and decided to manually download each jar that I needed and place it in its proper spot in the .m2 folder. But maven doesn't seem to recognize that the jar files are there and continues trying and failing to download them. So if anyone can tell me what I might need to do to get those downloaded properly, or just get maven to recognize that they are already in the project, that'd be wonderful.
Thanks.
It is likely that you did not install the jars in the local repository using mvn install:install-file
. Check the usage.
see answer here http://java.net/projects/jersey/lists/users/archive/2011-02/message/176
You have to remove dependency on com.sun.jersey.jersey-test-framework, its "nothing" now; see helloworld sample for inspiration, basically you should have something like:
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
helloworld sample: http://download.java.net/maven/2/com/sun/jersey/samples/helloworld/1.6-SNAPSHOT/helloworld-1.6-SNAPSHOT-project.zip
精彩评论