Phased Deployment of Snapshot Artifacts with Maven and Jenkins

Description of the problem

We have several multi-module projects that depend on each other. So something like this:

  • messaging
  • framework
  • othercomponent

They have a separate version control repository and allow us to say that submodules inside messages and othercomponent use packages from submodules of the framework . All projects are OSGI-based multi-module projects. All of them have a server part and a single part of the GUI (Eclipse RAP + RCP). Thus, it ends with a three-stage maven-based build for all of these multi-module projects (since Tycho builds cannot be mixed with regular old Maven Builds):

  • Creating the server side
  • Creating a RAP GUI
  • RCP GUI String

And finally, there is a multi-module maven project for end products (lets call it our product ), which uses messaging , frameworks and othercomponent . Our product project has a different version number than the other three having a common version number.

We build everything with Jenkins, and tasks start each other depending on the dependency tree. The company decided to use snapshots to get more direct and faster feedback between the developers of the three base projects and the developers of ourproduct . This may be a good idea, however there is a big problem.

If something is broken during the build, the snapshot repository contains snapshots of messages , frames and othercomponents that cannot work together.Thus, the developers of our product have to wait for the installed snapshot (otherwise they won’t even be able to compile for some time). Another problem is that during assembly, the set of images is also incompatible.

Idea

For messages , framework and othercomponent in Jenkins there is a definite final assignment. If this completes, then the snapshot set should work, so ourproduct team can use it. Therefore, I would need to collect somehow the snapshots created by the assembly chain and deploy them only if the whole assembly chain was successful.

  • Is there any existing opportunity to do this?

My idea was to simply change jobs, to do just the installation and not to deploy. Then at the end, I could search for the created snapshots in the local maven repository and deploy them using a script.

  • There is a definite concept for Maven (possibly only with Nexus pro). Will he say anything about snapshots?

Any idea is welcome. However, I cannot change the fact of using snapshots. Therefore, it makes no sense to convince me to use releases without snapshots.

+1
maven jenkins staging snapshot tycho
source share
2 answers

Decision

I found a nice workaround. Actions:

  • The assembly steps must be deployed to a temporary folder instead of the usual target repository using the altDeploymentRepository parameter (see http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html )

    mvn deploy -DaltDeploymentRepository = stagingFolder :: default :: file: /// c: / mytempfolder

  • Run any number of build steps with this option , and artifacts will be collected in a folder. You can even resume assembly without problems. You can overwrite artifacts (I do not recommend doing this)

  • You need to run the following command after completing all the assembly steps (see http://mojo.codehaus.org/wagon-maven-plugin/copy-mojo.html ). This loads all artifacts that were temporarily collected in a folder:

    mvn org.codehaus.mojo: wagon-maven-plugin: copy -Dwagon.source = file: /// c: / mytempfolder -Dwagon.target = http://somerepository.com/repositories/snapshots -Dwagon.targetId = idreferredinsettingsxmltogetauthorization

Important Note

The wagon target should be launched in a folder where there is no pom file (therefore, it should be launched without a project). Otherwise, there is a strange error with the fromDir parameter.

Known Limitations

  • The assembly steps must be performed using the same local repository, since if the steps need artifacts created by other artifacts, they can find it in the local repository.
  • This solution does not read POM to get the repository to which artifacts should be uploaded. Today it is associated with a team of wagons. But I can live with him now :)
+2
source share

Jenkins allows you to collect artifacts of other assemblies (if they mark them in their project configuration). Your integration tests could use this design to collect the necessary data from the prefabricated snapshots, and only after the integration tests are completed, just upload the package set to Nexus. You can start by verifying the manifest from the OSGI packages. I suggest using a jar signature as an intermediate marker, because it is easy in forensic analysis using devops.

The btw Nexus Pro has a staging concept.

+1
source share

All Articles