Hi all !

My context :
- 1 pom Artefact
- This artefact generate N zip artefacts via the maven-assembly-plugin.
These N artefact are contextualized upon a target deployment environnment.
- N = ~5 for the moment, but it can evolve depending on the number of
environnment that will grow in the future
- The N artefacts are not inevitably used (staging)
- I can't change my zip artefact content/architecture (let's say it's fixed
by my customer)
- My zip artefacts are relatively big (~200Mo each)
- They diverge only by 4-5 configuration files packed into the zip at
different places
- I'm frequently releasing using maven-release-plugin. Build
reproductibility is a top level requirement.

I'm wondering about the best approach to take to have something viable for
the project.

I already listed 3 way of agencing my pom :
1/ I use N maven-assembly-plugin <executions>, with different <descriptor> /
<filters>
Drawbacks :
- mvn package take a loooong time because it archives N * 200Mo files
- when launching release:perform (and thus, calling the deploy goal), I
deploy N*200Mo files in my maven repository ... even if I don't use the
artefacts in every deployment environnment. I find it really overdimensioned
since only a few configuration files differ between my N artefacts :(

2/ I use only 1 maven-assembly-plugin <execution> with "variabilized"
<descriptor> / <filters>.
For example :
<descriptor>assemblies/${target.env}-assembly.xml</descriptor>
When building, I must set -Dtarget.env property key to switch between
environnments
Drawbacks :
- Doesn't satisfy the build reproductibility requirement very well, since I
must specify my target environnment during the build and during the tag (and
this information is nowhere persisted)

3/ Same as 2/ except that I put maven-assembly-plugin configuration into an
inactive profile.
That is, by default, no zip artefact will be produced during mvn package.
During release:prepare, I will only tag the pom and the assemblies
configuration files.
When calling release:perform, I'll have to specify a -Dtarget.env to
determine on which environnment I want to deploy my artefact.
My artefact will then be uploaded on my maven repository, too.
Drawbacks :
- I must separate my release:prepare & release:perform calls in my CI
server. The first one will be called once for a release. The second one will
be called several times after release:prepare, to deploy my artefact on my N
environnments.

Obviously, I find the 3rd choice the best one...
I'm interested in your feedback / opinion on the question. Is there a silver
bullet here ?

Frédéric

Reply via email to