문제

Actually I see two alternatives how can I deploy my project to NEXUS:

  1. Configure distributionManagement and deploy-plugin in pom.xml. That in jenkins I should only call mvn deploy and my project will be deployed to the environment
  2. Create in Jenkins Post-build Actions -> Deploy artifacts to maven repository, where I can set repository URL, repository ID and so on

Question

What is pros and cons of each approach comparing with one another?

도움이 되었습니까?

해결책

If you are configuring the deployment in Jenkins build configuration you are doing two things

  • you are separating the deployment from the project itself and therefore potentially can have different deployments for the same project
  • you remove the deployment setup from your version control setup/your source code

If you are leaving it in the pom using the default Maven setup you can run deployment of the project without modification from the commandline on any machine that has the credentials set up correctly. This can greatly help wit troubleshooting and it makes the setup independent of whatever CI server you use.

Both approaches as well as more custom setups like using the Artifactory Build Integration or the Nexus Staging Maven Plugin usage are fine. It will mostly depend on what you are aiming to achieve.

Personally I believe that the configuration should not be isolated to Jenkins and should remain with the project in the pom. But that is just my 2c.

다른 팁

Thanks for adding the Artifactory tag, now I can give you one more option - Artifactory Build Integration. With Artifactory Jenkins plugin you can configure your deployment options (target repository, whether or not you want to deploy build information, environment variables and custom properties etc.) without polluting your developers pom with ci-eyes only information.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top