maven 无法从存储库下载 jar 文件,无法识别已经存在的 jar 文件
我是 Maven 和 m2eclipse 的新手,并且第一次尝试将主 pom.xml 文件作为 Maven 安装运行,但它无法正常工作。它尝试下载一些 jar 文件(从公共和私人存储库),但似乎无法访问存储库。
该代码是由我公司的其他人编写的,在其他计算机上运行良好,所以我不认为是这样,这更可能是我如何设置 eclipse、maven 和 m2eclipse 的问题。无论如何,我都会发布 pom.xml 的示例
<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>
与此特定块相关的错误是:
无法在项目 webservice-service-ejbs 上执行目标:无法解析项目 com.lexi:webservice-service-ejbs:ejb:2.1 的依赖关系:无法收集 [...] com.sun.jersey 的依赖关系.jersey-test-framework:jersey-test-framework-core:jar:1.4(测试)
因此,在与此争论了一段时间后,我厌倦了并决定手动下载每个 jar我需要并将其放置在 .m2 文件夹中的正确位置。但 maven 似乎没有识别出 jar 文件在那里,并继续尝试下载它们,但失败了。因此,如果有人能告诉我我可能需要做什么才能正确下载这些内容,或者只是让 Maven 认识到它们已经在项目中,那就太好了。
谢谢。
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 repositories), 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能没有使用
mvn install:install-file
在本地存储库中安装 jar。检查用法。It is likely that you did not install the jars in the local repository using
mvn install:install-file
. Check the usage.请参阅此处的答案 http://java.net/projects/ jersey/lists/users/archive/2011-02/message/176
您必须删除对 com.sun.jersey.jersey-test-framework 的依赖,现在它“什么都没有”;请参阅 helloworld 示例以获取灵感,基本上您应该有类似的内容:
helloworld 示例: http://download.java.net/maven/2/com/sun/jersey/samples/helloworld/1.6-SNAPSHOT/helloworld-1.6-SNAPSHOT-project .zip
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:
helloworld sample: http://download.java.net/maven/2/com/sun/jersey/samples/helloworld/1.6-SNAPSHOT/helloworld-1.6-SNAPSHOT-project.zip