This question does an excellent job of explaining how to skip a Maven profile based upon the Properties sent to Maven, conditionally execute maven plugins which would be great, but I'm in a situation where I have two Profiles that execute one after the other, however if one of the Java methods within the first Profile gets into a specific state, I do not want to run the second Profile at all.
I have several very good reasons for wanting to run this entire process from a single Maven command.
Is this possible?
I'm imagining something like this, but don't really know how to reference the property from Java.
From pom.xml:
<profile>
<id>Profile 2</id>
<activation>
<property><name>!maven.test.skip</name></property>
<property><name>!skipTests</name></property>
</activation>
<build>
...
</build>
</profile>
From some Java Class:
public static void main(String... args) {
if(weShouldRunProfile2){
skipTests = false; //obviously wrong, but not sure what to put here if this is even possible
}
}