Let's say I have a profile "dostuff" defined in a pom.xml that uses a plugin to do some stuff when the user runs mvn -P dostuff:
<profiles>
<profile>
<id>dostuff</id>
<build>
<plugins>
<plugin>
...
</plugin>
<plugins>
</build>
</profile>
<profiles>
The task the profile performs have been replaced by a new non-maven command entirely.
Of course I can just remove the profile, but that has two problems:
[WARNING] The requested profile "dostuff" could not be activated because it does not exist.
So, I would like any use of the profile "dostuff" to produce an error with a message telling them to use the new non-maven command instead.
Is that even possible? It's a plus if the solution doesn't require a plugin.
The maven-enforcer-plugin has a built-in rule to require a profile is activated. Perhaps you could write your own rule to ban a profile, using that code as a starting point.
Just put the profile in your pom and use it to show a message and throw an exception. You could e.g. use the Antrun plugin to echo a message.
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