I want to have a profile that triggers a certain plugin(say PMD) but I want to explicitly disable that plugin execution sometimes.
So I want to have a profile that is always active except when a property is defined.
Something like mvn -Dnopmd clean install, and the profile gets de-activated. Other than that the profile should always be active.
Profiles can be activated in the Maven settings, via the <activeProfiles> section. This section takes a list of <activeProfile> elements, each containing a profile-id inside. Profiles listed in the <activeProfiles> tag would be activated by default every time a project use it.
You can activate a profile when a property is not specfied like so:
<profile>
<id>someprofile</id>
<activation>
<property>
<name>!property.name</name>
</property>
</activation>
</profile>
This is also explained in the Maven documentation, Introduction to Build Profiles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With