Maven - deploy dependencies to remote repository

前端 未结 3 1857
小蘑菇
小蘑菇 2020-12-28 09:46

I have a few projects with LOTS of maven dependencies. When I invoke the command mvn deploy (or some variation of it), I would like to not only have the project itself depl

3条回答
  •  余生分开走
    2020-12-28 10:25

    I propose the following solution which looks a lot less like trial and error for resolving dependencies compared to the existing answers.

    What you can do is to call mvn -Dmdep.copyPom=true dependency:copy-dependencies after deploying the main project. This will copy transitively all dependencies of your project to target/dependency including their respective pom files.

    You can then iterate through all of the dependencies and deploy them to the repository using deploy:deploy-file, e.g. with such a bash loop:

    for pom in target/dependency/*.pom; do mvn deploy:deploy-file -Durl=http://your/repo -Dfile="${pom%%.pom}.jar" -DgeneratePom=false -DpomFile="$pom"
    

提交回复
热议问题