Reputation: 584
I need to have a 2-dimensions profiles organisation in my pom.xml.
The project is about a fatclient app that comes in different flavours. Each flavour comes a slightly different set of dependencies, internalization files, splash screen, ... This is one dimension of the profiles.
I also build the app for different os: windows, linux, mac. This is the 2nd dimension of the profiles. And some stuff must change depending on the target (e.g. for windows, I build a ZIP file, while for linux and mac, I build a TAR.GZ file)
My approach for resolving this is by using the pom.xml profiles for the flavours, and to use the .m2/settings.xml profiles for the os target. It works, but it isn't nice. Because the .m2/settings.xml should be limited to config specific to the user and not contain "build logic".
I'd like to "transfer" the "build logic" that I put .m2/settings.xml into the pom.xml. But I don't want to have 1 Profile level having (#Flavours x #Os) profiles (e.g. flavour1-os1, flavour1-os2, ...)
Is this achievable ? Is there a way to implement this 2 levels of profiles in the pom.xml ?
Upvotes: 1
Views: 346
Reputation: 14762
Declare one profile for each flavour:
<profile>
<id>flav1</id>
...
</profile>
<profile>
<id>flav2</id>
...
</profile>
<profile>
<id>flav3</id>
...
</profile>
and one for each OS:
<profile>
<id>win</id>
...
</profile>
<profile>
<id>linux</id>
...
</profile>
<profile>
<id>mac</id>
...
</profile>
Activate them individually by e.g:
mvn -P flav1, linux ...
Upvotes: 1