Reputation: 5552
I'm building a project using maven and I need to ensure it works over Java SE and different Java EE containers. There're already integration tests written for WildFly container. And now I'm moving to Java SE.
But face to this multiple test environments, how should I handle them in maven ? Should I use <profile>
, <module>
or something else ?
<profile>
is useful to switch between different profiles and each of them can have their specific dependencies. So in my case, there might be profiles: wildfly-embedded
, wildfly-managed
, java-se
etc. But I need to ensure the project works on every profile, is it possible to run all the profiles in one command ?
<module>
can handle project inheritance. After reading the post SO • Why and when to create a multi-module Maven project?, I'm still confused about if I should use it in my case.
Can somebody give me some ideas ? That will be very helpful, thanks.
Upvotes: 1
Views: 96
Reputation: 12345
If you keep in mind that the resulting artifact should always be the same no matter the activated profiles, then you should understand that profile is not the correct solution (although it is very often abused for it. Don't try to go for that advice!) Configuration should be outside the artifact, so you can reuse the same artifact over and over again. Since many people ask for the proper solution with embedded configuration, Karl Heinz created https://github.com/khmarbaise/multienv-maven-plugin . This is probably the closest you'll get to a valid Maven project setup.
Upvotes: 1