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

后端 未结 4 2068
灰色年华
灰色年华 2021-02-14 11:59

In my project, there are a number of dependencies that are transitively included from other dependencies that do not have pom.xml files available in any of our corporate reposit

相关标签:
4条回答
  • 2021-02-14 12:18

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

    0 讨论(0)
  • 2021-02-14 12:26
    • 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 !

    0 讨论(0)
  • 2021-02-14 12:30

    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>
    
    0 讨论(0)
  • 2021-02-14 12:39

    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).

    0 讨论(0)
提交回复
热议问题