I have a project which has several custom descriptors written for the assembly plugin. Is there a way to run only one of those descriptors at a time instead of the whole bunch? I tried using the descriptors switch as documented here, passing in the full path to the one descriptor that I wanted to run, but instead it's running all of the descriptors in my app's main pom file, seeming to ignore the switch I specified.
Asked
Active
Viewed 2,853 times
3
-
What are the steps to reproduce, what version of the plugin are you using, how is it configured exactly, can you provide your `pom.xml`. Please, help the readers a bit... – Pascal Thivent Nov 24 '09 at 16:54
1 Answers
3
Probably the easiest way to do so, is by using Maven Profiles.
Define some profiles in your pom.xml:
<profiles>
<profile>
<id>profile-1</id>
<properties>
<assembly-config>assem1.xml</assembly-config>
</properties>
</profile>
<profile>
<id>profile-2</id>
<properties>
<assembly-config>assem2.xml</assembly-config>
</properties>
</profile>
</profiles>
Then you use that particular property for the configuration of the assembly plugin:
...
<descriptor>src/main/assembly/${assembly-config}</descriptor>
...
Then run your maven build with the -P option: mvn -P profile-1 compile
So, summarized, if you choose a profile at buildtime, the property assembly-config will be set depending on the defined profile. The assembly configuration depends in that case on the chosen profile.
Hope this helps!

Tim Van Laer
- 2,434
- 26
- 30
-
1I was hoping it wouldn't come to that, but I can't see any other way to do it either. Thanks. – UrLicht Dec 02 '09 at 18:15