How can we achieve the same effect as Jenkins 1's "Deploy artifacts to Maven repository" with Jenkins 2's pipelines?

34 views
Skip to first unread message

Aaron Digulla

unread,
Jan 16, 2019, 11:16:22 AM1/16/19
to Jenkins Users
Hello,

For releases, I'd like to build and test all Maven modules and after the build, deploy everything at once (otherwise, someone has to waste time to clean up the mess in Nexus).

In Jenkins 1, this was simple: Build with "mvn clean install" and add a post-build job "Deploy artifacts to Maven repository".

Jenkins 2 still maintains a list of all artifacts which need to be deployed but I couldn't find the out how to recreate the old post-build job.

How do I do that?

Regards,
Message has been deleted

David Karlsen

unread,
Jan 17, 2019, 12:23:40 PM1/17/19
to jenkins...@googlegroups.com
I use the option deployAtEnd in the maven plugin to achieve this 

Den tor. 17. jan. 2019, 16:59 skrev Cyrille Le Clerc <clec...@cloudbees.com>:
Hello AAron,

This capability is niot av

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8813b207-d8f5-4718-9401-a130b475899b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cyrille Le Clerc

unread,
Jan 18, 2019, 5:54:17 AM1/18/19
to Jenkins Users
Hello Aaron, thanks David

As David said, the "Deploy artifacts to Maven repository" feature of the Maven Job type does not exist "as is" in the Pipeline Maven integration.

The recommended solution is to use the "-DdeployAtEnd=true" feature of Maven. See https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html#deployAtEnd .

Can you please describe more your need. Is it one of
  • Prevent partial upload of maven artifacts when a multi module project fails
  • Introduce intermediate build steps between the completion of "mvn verify" and the upload of the artifacts (the "deploy" part of the maven build)
  • Have retires if the artifact repository is unvailable
  • Other
Cyrille

Aaron Digulla

unread,
Jan 20, 2019, 2:36:35 PM1/20/19
to Jenkins Users
Hi Cyrille,

My main goal is prevent partial uploads in release builds since that could cause a lot of manual effort to clean up in Nexus. I'm not that concerned with partial snapshot uploads since we try to avoid them (we work a lot with branches).

But being able to run some additional tests before the upload phase would be nice, too (for example, to verify that some resources are in the right place in a WAR; that has bugged us in the past and it would be nice to check with an error message explaining how to fix it).

The last goal would be chained multi-branch builds. Imagine you want to build Maven and then a Maven plugin. For the plugin, you need a new feature in Maven. So you create two branches with the same name in two projects. During the build, you want the plugin job to see a Maven repo (local or remote) which contains the branch of the Maven build - but no one else!

A step which allows to deploy artifacts to Nexus would be the basis for this work.

Regards,

A. Digulla
Reply all
Reply to author
Forward
0 new messages