Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Injecting custom maven property in pom.xml

I want to create a boolean flag in my pom.xml whether to run tests or not. I found a way to do this here. I'm using the Skipping By Default option at the bottom. It works, but when I try to change the name of the property, it doesn't work. For example, the site recommends:

<project>
  [...]
  <properties>
    <skipTests>true</skipTests>
  </properties>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
          <skipTests>${skipTests}</skipTests>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

And that works, but this doesn't:

<project>
  [...]
  <properties>
    <skip.base.tests>true</skip.base.tests>
  </properties>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
          <skipTests>${skip.base.tests}</skipTests>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

Comments