Hi All:

I want to use a property in a profile in a Java 8 Maven 3.8.1 project, but
it does not work within a file activation element. In the example below
this file activation works:

<exists>${java.home}/../lib/tools.jar</exists>

but this one does not:

<exists>${toolsJar}</exists>

The profile:

  <profiles>
    <profile>
      <id>jdk9</id>
      <activation>
        <jdk>[1.9,)</jdk>
      </activation>
      <!-- No dependencies needed by Jigsaw -->
      <dependencies />
    </profile>
    <profile>
      <id>default-jdk</id>
      <properties>
        <toolsJar>${java.home}/../lib/tools.jar</toolsJar>
      </properties>
      <activation>
        <file>
          <!-- ${toolsJar} does not work here. -->
          <exists>${java.home}/../lib/tools.jar</exists>
        </file>
      </activation>
      <dependencies>
        <dependency>
          <groupId>jdk.tools</groupId>
          <artifactId>jdk.tools</artifactId>
          <scope>system</scope>
          <version>8</version>
          <systemPath>${toolsJar}</systemPath>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

Am I doing something wrong?

Gary

Reply via email to