How do I stop Maven 2.x from trying to retrieve non-existent pom.xml files for dependencies every build?

[亡魂溺海] 提交于 2019-12-03 12:02:21

Pascal's answer is correct for two local build workarounds. However, your best option is to request the owners of these projects to create POMs for the artifacts. They don't need to be complex, the simple alternative that Maven is using internally will work:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>aGroupId</groupId>
  <artifactId>aArtifactId</artifactId>
  <version>4.0.14i</version>
</project>

Downloading a POM is really a central concept in Maven to support transitive dependencies (actually, a dependency isn't just a JAR, see 3.5.5. Maven's Dependency Management for nice details on that) so I don't know if you can prevent it.

Of course, the right thing to do would be to fix the root cause of the problem. But if you can't, maybe you can run your build in offline mode (using the -o option). Or maybe you could just "install" the artifacts in your local repository using install:install-file and instruct the plugin to generate a pom for them using the generatePom optional parameter (but this obviously doesn't "scale" really well).

Set up a Nexus Repository (or similar) and upload the artifacts there. Nexus will automatically create basic poms for artifacts you upload.

  • download to local repo
  • setup nexus and upload
  • work offline

maybe the best idea is to get rid of maven all the way, it is horror !

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!