Beware of passing -P to Maven

Maven has a cool feature where you can separate different settings/build configuration bundles in what it calls profiles. To active a profile, one would pass:

$ mvn -Pdevelopment-only-settings compile

If there's a profile you want to always activate, it can itself have a setting like this:

<settings>
..
  <profiles>
    <profile>
      <id>development-only-settings</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
    </profile>
  </profiles>
</settings>

Alternatively, you can activate the profile(s) you need by passing the -P parameter to Maven:

$ mvn -Pfoo compile

The thing, though, is that this will disable all the profiles you have defined with <activeByDefault/> (warning)

To be sure that a profile always is activated, even if the user (like Jenkins) passes -P to Maven, instead use:

<settings>
..
  <profiles>
    <profile>
      <id>development-only-settings</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>development</activeProfile>
  </activeProfiles>
</settings>

~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert