[英]Jenkins Maven Nexus, how to learn it?
TASK: I was charged to make/test CI pipeline for any Java (Maven preferably) sources in Jenkins (all Devops tools must be in Docker containers) . 任务:我负责为Jenkins中的任何Java(最好是Maven)源制作/测试CI管道(所有Devops工具必须位于Docker容器中)。 I need to do basic stages :
我需要做一些基本的步骤:
1) Get source from github - done (I did by creating task in Jenkins and used example java app from some github repo) 1)从github获取源代码-完成(我通过在Jenkins中创建任务并从某些github存储库中使用示例Java应用程序来完成)
2) Build in Maven - done 2)在Maven中构建-完成
3) Make Junit tests - done 3)做Junit测试-完成
4) Push artifacts ( .war file probably) to Nexus 3 repository - need to solve 4)将工件(可能是.war文件)推送到Nexus 3存储库-需要解决
HOW I tried to SOLVE: I've found the docker-ci-tool-stack ( "Devops-ready" platform: Jenkins, SonarQube, Nexus, GitLab) , so I've just used it for my purpose (here it is https://github.com/marcelbirkner/docker-ci-tool-stack ) First I've tried to understand building app example from that repo, but stuck in Groove DSL scripts. 如何尝试解决:我已经找到了docker-ci-tool-stack(“支持Devops的”平台:Jenkins,SonarQube,Nexus,GitLab),所以我只是将它用于我的目的(这里是https http://github.com/marcelbirkner/docker-ci-tool-stack )首先,我试图从该存储库中了解构建应用程序示例,但陷入了Groove DSL脚本中。 After I've been trying look some tutorials, documents on integration: Jenkins , Maven and Nexus, but it's incomprehensible for me.
在尝试了一些教程之后,我找到了一些有关集成的文档:Jenkins,Maven和Nexus,但是对我来说却是不可理解的。 I agree, that I should own each tool separately and after combine it together (and work in other place probably) , but I've a terms from by boss... What should I do?
我同意,我应该分别拥有每个工具,然后将它们组合在一起(可能在其他地方工作),但是我有老板的话……我该怎么办? I passed some courses in Linux Academy for Git, Docker and Jenkins, but I still feel really raw in practice that DevOps (CI/CD), Thank you.
我在Linux Academy上通过了一些有关Git,Docker和Jenkins的课程,但是在实践中,我仍然对DevOps(CI / CD)感到很头疼,谢谢。
Well you can try other way. 好吧,您可以尝试其他方式。 which i can say non maven way and it is like using nexus artifact uploader plugin .
我可以说是非行家方式,就像使用nexus工件上传器插件。 If you are use jenkins pipeline then there step for it in syntax generator.
如果您使用的是jenkins管道,则可以在语法生成器中执行此步骤。 Refer the images
参考图像
here groupid and version can be any value i chose this random values in repository pass the name of repo that you created in nexus dashboard wH.png artifactid and classifier can be any value. 在这里,groupid和version可以是任何值,我在存储库中选择了此随机值,并传递了您在nexus仪表板中创建的repo的名称 。wH.pngartifactid 和classifier可以是任何值。 in the type write war if its war file , jar if its jar or zip if its zip file;
如果类型是war文件,则写war;如果jar是jar,则写jar;如果zip文件是zip,则写; Then in File section pass the path of war file which was created after creating the build When you click generate buld you will get this step script just paste it after the step where war file has been build
然后在“文件”部分中,传递创建构建文件后创建的战争文件的路径。 单击“生成”时,您将得到此步骤脚本,只需将其粘贴到构建战争文件的步骤之后即可
You can do this by adding the distributionManagement section to your pom.xml file. 您可以通过将distributionManagement部分添加到pom.xml文件中来实现。
<project ...>
...
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://your-host:8081/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://your-host:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
</project>
And add in Jenkins job to Maven(mvn) section: 并将Jenkins工作添加到Maven(mvn)部分:
deploy
Briefly: 简要地:
More details here: 此处有更多详细信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.