You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andreas Sewe <an...@buildingblobs.com> on 2020/07/07 09:45:58 UTC
Profile activation depending on presence of toolchains file
Hi,
Maven allows the user to specify a toolchains file via its --toolchains
parameter (defaulting to ~/.m2/toolchains.xml).
While useful, this ability to override the file's location is
unfortunately a problem if one wants to make the use of the
maven-toolchains-plugin *conditional* upon the presence of said file:
<profiles>
<profile>
<id>toolchains</id>
<activation>
<file>
<exists>${user.home}/.m2/toolchains.xml</exists>
</file>
</activation>
... use maven-toolchains-plugin ...
</profile>
</profiles>
The above should really check for the presence of the file given via
--toolchains; instead, it *always* checks the *default* file location.
So my question is this: Does Maven set (e.g., during toolchain
initialization [1]) a property that can be queried in a profile?
Best wishes,
Andreas
[1] <https://maven.apache.org/docs/3.3.1/release-notes.html#toolchains>