Based on a comment on my previous article i would like to show how to add dependencies to the generated artifacts depending on the environment.
The most important problem is: How to get the different artifacts? If you have artifacts which are stored in a Maven Repository like Maven Central it is easy to get them. Just use the Maven Dependency Plugin to get the artifacts. This means you have to add the following to your pom file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Apart from that you need a separate execution block for every environment (test, qa and production in our case). Furthermore if you need more than one dependency you can simply achieve this by adding them in the artifactItems block with their appropriate groupId, artifactId etc. So far so good. But what happens if you need artifacts which are not located within an Maven like repository? Ok not problem at all. You can use the wagon-maven-plugin to download the appropriate artifacts. To do such things you simply enhance your pom with the appropriate configuration for the wagon-maven-plugin:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
In this case i have added a
.tar.gz archive downloaded from Apache archive and added that to the qa environment.
The full code of a full fledged Maven build for that and the previous article can be found