4

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

David H
  • 1,346
  • 3
  • 16
  • 29
  • Jenkins will not be doing anything you don't already do manually. How do you currently deploy your artifacts? – Slav Mar 16 '14 at 23:44
  • 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 Mar 17 '14 at 09:08

2 Answers2

4

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

Community
  • 1
  • 1
Slav
  • 27,057
  • 11
  • 80
  • 104
  • Slav,you are my man. I have saw your answer, is there a way to "deploy all modules" from my build job ? – David H Mar 18 '14 at 16:38
  • I don't actually have that much experience with Maven. Our project is relatively small, and we build all modules in a single job (a wrapper pom.xml builds all submodules). The resultant .zip has a folder with all dependent .jars in it. Maybe not the best approach for Maven projects, but does what we need for us. – Slav Mar 18 '14 at 17:08
  • @DavidH, just came across this from the on-page help for **Copy Artifacts** action: `If a Maven project is specified, artifacts from all of its modules will be copied. Enter JOBNAME/MODULENAME here to copy from a particular module`, so just specifying the maven project name by default will copy all modules. Hope this helps – Slav Mar 21 '14 at 13:55
  • Copy Artifacts will actually copy all modules and i already knew about that. What i was wondering if i can say to the deploy plugin to deploy all copied artifacts (without specifying ) ,just like when i am creating maven job that deploy all modules. – David H Mar 24 '14 at 09:19
0

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.
Vitalliuss
  • 1,614
  • 1
  • 12
  • 10