Mincong Huang
Mincong Huang

Reputation: 5552

How to handle multiple test environments in maven?

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 ?

Can somebody give me some ideas ? That will be very helpful, thanks.

Upvotes: 1

Views: 96

Answers (1)

Robert Scholte
Robert Scholte

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

Related Questions