简体   繁体   English

如何使用Maven,Jenkins Pipeline和Artifactory?

[英]How to use Maven, Jenkins Pipeline and Artifactory?

I have a large, complex project, driven by Maven, built by Jenkins and reposing in Artifactory. 我有一个大型的,复杂的项目,由Maven驱动,由詹金斯(Jenkins)建造,并位于Artifactory。 Projects are configured as multi-branch pipelines, and Jenkinsfiles are working. 项目被配置为多分支管道,并且Jenkinsfiles正在工作。 I have been using the Jenkins Artifactory plugin with success. 我一直在成功使用Jenkins Artifactory插件。 When a job is run (via the SCM trigger or directly) it all works correctly. 运行作业时(通过SCM触发器或直接运行),所有作业均正常工作。 However, the jobs do not respond to the 'Build whenever a SNAPSHOT dependency is built' trigger. 但是,作业不会响应“每当生成SNAPSHOT依赖项时生成”触发器。 This means that I can only 'pull' the build of a top-level project - whereas I want these to be built when the lower-level dependencies are modified. 这意味着我只能“拉”顶层项目的构建-而我希望在修改较低层的依赖项时构建它们。 I am told that this (Jenkins) trigger will only work within a 'withMaven' step, and only when 'mvn' is called within a 'sh' step - and I've shown that it does work in this case. 有人告诉我,此(Jenkins)触发器仅在“ withMaven”步骤中起作用,并且仅在“ sh”步骤中调用“ mvn”时才起作用-我已经证明了在这种情况下它可以起作用。 BUT I can't use the Jenkins Artifactory plugin inside the withMaven step. 但是我不能在withMaven步骤中使用Jenkins Artifactory插件。 I have looked at the maven-artifactory-plugin (pushing the responsibility into the maven build), and this might be the way to go ... I wondered if anyone has managed to configure/use these tools successfully in this environment - and, if so, what combination of maven/jenkins plugins did you use? 我研究过maven-artifactory-plugin(将责任推入Maven构建中),这可能是要走的路...我想知道是否有人在此环境中成功配置/使用了这些工具-并且,如果是这样,您使用了哪种Maven / Jenkins插件组合? Thanks tim 蒂姆

I've had to use a combined approach, but this seems to work : All Maven projects use 'withMaven' to build and deploy with the pom.xml. 我不得不使用一种组合方法,但这似乎可行:所有Maven项目都使用“ withMaven”来构建和部署pom.xml。 Any projects which need more complex processing also have a separate Jenkinsfile, which uses the Jenkins Artifactory plugin. 任何需要更复杂处理的项目也都有单独的Jenkinsfile,该文件使用Jenkins Artifactory插件。 This allows the capture of the BuildInfo. 这允许捕获BuildInfo。 I found there was no way to get my desired result using any other combination of plugins. 我发现使用任何其他插件组合都无法获得我想要的结果。 G'luck G'luck

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM