4
votes

I have read and searched here for simple techinique about creating jobs for maven/(multi-module), But i really didn't got how things should be done. What i wanted to do is :

Build(mvn package) =>integration-test (i am using many environment using slaves)=> Deploy artifacts

I have used "copy artifact to slave" plugin in order to make integration test. I have used Join plugin for triggering deploy(if all integration tests has been passed) . But i really dont know how can i pass my modules to Deploy artifacts job.

I was wondering if deploy artifacts should be a maven job or freestyle job, and how can i use my modules properties i.e artifact-id,group-id,repository properties from my "Build Job" that is currently is a maven job. I can use Copy Artifact Plugin to pass my artifacts to Deploy job but i dont know how can i deploy them.

thanks for helpers

2
Jenkins will not be doing anything you don't already do manually. How do you currently deploy your artifacts?Slav
with maven, but the different is that now i have seperated jobs with separated workspace , and if i use pipeline, the state of my source control could be changed when i would checkout and deploy as my final step. Any suggestions?David H

2 Answers

4
votes

You need a Build job (which you already have), and a Deploy job (which you will write with Maven). The Deploy job will copy the artifacts (the ones you specify) from your build job and then act on those. The only thing left is: how to tell which artifacts to pick.

I have a detailed answer here How to promote a specific build number from another job in Jenkins? detailing how to tie Build and Deploy jobs using Promotions

0
votes

Steps may be as following:

  1. Build (mvn package) and archive the artifacts (e.g. .jar file)
  2. Test. Use Copy Artifact Plugin to copy artifacts from job #1 in job config add Post Steps -> Copy artifacts from another project and set the mask for necessary files, say *.jar. Depending on test results you may publish the jar and deploy it.