4

I have set up a build pipeline for a war project using Jenkins and the build-pipeline-plugin . It consists of two actual jobs and an final manual job which deploys on Q&A .

Build pipeline

Each of the jobs is configured to run the same project, activating different profiles. The first job - fast - is the default build, compiling the sources and running unit tests. The second job - browser - runs the Selenium-based browser tests. The third jobs deploys the war file to the Q&A server.

Each job produces a new war file, which bothers me for two reasons:

  1. Even though only the needed goals are executed, e.g. no tests when deploying to Q&A, the build still takes a little too long, as the WAR file has lots of files in it.
  2. We rely on the build number from Jenkins to find out which build the artifact is from. Up till now it was the number from the 'fast' job, but now it is the number from the 'qa-deploy' job.

How can I configure Jenkins and/or Maven to reuse the artifacts from the first job?

I'd prefer a solution which does not change the overall project structure, as our project has a single war module, and splitting it means more work in documenting the changes and it is simpler to have everything in once place.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
  • Is this a multi-module build? Or is this a single module which results in a war (means packaging war)? In particular the selenium tests are integration tests so the best is to have a separate module with integration tests. – khmarbaise Aug 05 '11 at 10:43
  • @khmarbaise: our project has a single war module – Robert Munteanu Aug 05 '11 at 12:54
  • Hm. How do you integration test with selenium ? (via integration-test phase? via maven-failsave-plugin?). I would suggest to have different modules for such purposes. If you have multi-module build with a war-module and it-module the it-module can use the war-artifact for integration tests. May be you can use cargo-plugin to run integration tests (deploy to container) .. – khmarbaise Aug 05 '11 at 13:07

2 Answers2

2

You could have one project that builds your .war, then copy it from that project into the dependent projects using the Copy Artifact Plugin here.

Community
  • 1
  • 1
craigforster
  • 2,589
  • 1
  • 16
  • 10
1

I would really like to suggest to split this up into two modules and have the integration test declare a dependency on the war module, which might also contain the deploy action.

This is a much more flexible approach and not that much of an effort.

Torsten
  • 6,184
  • 1
  • 34
  • 31
  • If the integration test would depend on the war project , wouldn't it pick the war project up from the reactor, building it all over again? – Robert Munteanu Aug 05 '11 at 12:56
  • It would pick up the last built artifact (war file) from your local repository. Please note that you can also built a war overlay project if you need to add or change configuration files to your existing war file. – Torsten Aug 05 '11 at 13:06