TL;DR
No, using activeByDefault
is NOT against maven best practices.
Details
As described in docs this feature is quite simple:
This profile will automatically be active for all builds unless another profile in the same POM is activated using one of the previously described methods. All profiles that are active by default are automatically deactivated when a profile in the POM is activated on the command line or through its activation config.
However in practice you may (and will) have a lot of different conditions for your project defaults:
- true active by default = always active, unless explicitly deactivated
- legacy systems = active, unless JDK is above (or below) specific version
- else-profile = active, when base profile is deactivated
- environment specific
- filesystem specific
- OS specific
- ...
Thus to use activeByDefault
you need to meet three conditions:
- you need such behaviour, as described in docs
- simple project structure
- controlled build environment (dev, CI)
I saw small projects where it was effectively used. I saw huge projects, where this feature was prohibited. And of course I saw projects with this feature misuse, caused by developer's ignorance (rtfm).
Conclusion
This feature could be useful for a small part of Maven community. It's an example of uncommon API, just like java.lang.Long#getLong
- useful in rare cases, but ignored by the majority of developers.
PS
Unconditional active by default profile:
<profile>
<id>active-unless-explicitly-deactivated</id>
<activation>
<file><exists>.</exists></file>
</activation>
...
</profile>
and it's deactivation:
./mvnw -P !active-unless-explicitly-deactivated ...