- Why do I sometimes get duplicate artifacts? They are not duplicated on disk. In the console log, I just see a single invocation of artifactsPublisher but sometimes, it reports the same artifact several times.
- Why isn't C listed as "Downstream Job" of B?
- How can I collect more information to debug this?
Hi Aaron,- Why do I sometimes get duplicate artifacts? They are not duplicated on disk. In the console log, I just see a single invocation of artifactsPublisher but sometimes, it reports the same artifact several times.Can you share the Jenkinsfile and the logs of your build? Usually artifact are displayed several time because "mvn package" or more than "package" ("install" or "deploy") is called several times in the build (e.g. invoking "mvn test" then "mvn deploy")
mvn --batch-mode --show-version -U clean install sonar:sonar -P coverage -Dmaven.repo.local=...
2.
mvn --batch-mode --show-version -U license:add-third-party license:third-party-report site -Dmaven.repo.local=...
The artifactsPublisher is invoked for #1, in #2, I'm disabling all publishers with "publisherStrategy: EXPLICIT". In the log, artifactsPublisher appears in the "build" step (#1) and not in the "license check" step (#2).
I really can't see why it gets additional artifacts in build of project A but not B. Jenkinsfile and Pipeline library are the same for both projects, so I'd expect the same output. The good news is that it's stable. It always archived twice in A and never in B.
- Why isn't C listed as "Downstream Job" of B?Can you please share screenshots of the "/maven" tab of both job "B" and "C"?
By default, downstream pipeline triggers only work when a pipeline is"success" or "unstable" and when the "mvn" goal is "deploy". This means that by default, "mvn package" or "mvn install" would not trigger a downstram pipeline.
- How can I collect more information to debug this?
>> Please see new FAQ entry https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin#PipelineMavenPlugin-HowcanItroubleshootproblemsoftriggerofdownstreampipelinesI have improved the FAQ entry based on your feedback, can you please have a look?
> I had to add a "Pipeline Graph Publisher" with the dropdown "Add Publisher Options". In there, I could switch the option "Maven lifecycle phase threshold" from "deploy" to "install".Good that you figured this out. The User Experience is not great but I didn't find better so far.
> That leaves the weird behavior of the artifactsPublisher and my comments about the new FAQ item.There is a non intuitive UX on the Pipeline Maven Plugin here: the artifactPublisher is just about "fingerprinting" and "archiving" the generated artifacts, it is NOT about updating the dependency graph that tracks (in a database) the produced and consumed artifacts. The "pipelineGraphPublisher" was introduced way after the "artifactsPublisher" (~6/12 months after).I suspect that the "pipelineGraphPublisher" is invoked twice in your pipeline.
[withMaven] Publishers: Pipeline Graph Publisher: 12 ms, Generated Artifacts Publisher: 31 ms, Junit Publisher: 52 ms, Dependencies Fingerprint Publisher: 4 ms, Jacoco Publisher: 12 ms, Open Task Scanner Publisher: 14 ms
> That triggers the downstream builds of feature branches. Now, I have to figure out how to share the artifacts. See my post "Chained builds" for my thoughts on that.I'll have a look, it is a difficult problem to solve. I didn't yet deep dive in https://maven.apache.org/maven-ci-friendly.html that seem to be related to the problem you want to solve.
dependencyManagement elements seems completely wrong to me.
Still, the idea to solve the "Maven doesn't support branches" by using one version per branch sounds promising. Does Jenkins take the version into account when building downstream projects i.e. if the downstream project has a dependency on 2.x-SNAPSHOT, it will not get triggered when I build 2.x-FOO-SNAPSHOT?