Profile activation depending on presence of toolchains file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Profile activation depending on presence of toolchains file

Andreas Sewe-3
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>


signature.asc (849 bytes) Download Attachment