Maven 2 & 3

POM properties do not override default system properties during POM interpolation

Details

  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

From Paul Benedict, on the maven dev list:

My issue might be related to MNG-3535.

I defined this property:
<java.version>1.6</java.version>

And used it in my compiler plugin:
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>${java.version}</source>
    <target>${java.version}</target>
  </configuration>
</plugin>

I know this use to work before 2.0.10, but now it does not.
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6.0_06
Usage: javac <options> <source files>
use -help for a list of possible options

The error here is that ${java.version} is not the value I specified,
but one that already exists.

Paul

I've replicated the problem in a separate test mock-up project.

Issue Links

Activity

Hide
Paul Benedict added a comment -

I am not quite sure what the correct solution is. Obviously, properties like java.version are really important, and if they can be overridden, that might lead to some unpredictable expectations.

I'd rather Maven err if such properties like java.* exist. However, if it is pre-existing behavior, maybe it's worth continuing.... but I must admit I feel that my code was inappropriate to use that property namespace.

Show
Paul Benedict added a comment - I am not quite sure what the correct solution is. Obviously, properties like java.version are really important, and if they can be overridden, that might lead to some unpredictable expectations. I'd rather Maven err if such properties like java.* exist. However, if it is pre-existing behavior, maybe it's worth continuing.... but I must admit I feel that my code was inappropriate to use that property namespace.
Hide
John Casey added a comment -

The two issues are similar, and I've improved the integration tests for MNG-3535 to include a failure case (to make it clearer what should succeed and what should fail among these two features).

Show
John Casey added a comment - The two issues are similar, and I've improved the integration tests for MNG-3535 to include a failure case (to make it clearer what should succeed and what should fail among these two features).
Hide
John Casey added a comment -

Need to verify that -Djava.version=1.4 will override <java.version> in POM.

Show
John Casey added a comment - Need to verify that -Djava.version=1.4 will override <java.version> in POM.
Hide
John Casey added a comment -

fixed CLI overrides of POM properties, and added another integration test for this case.

Show
John Casey added a comment - fixed CLI overrides of POM properties, and added another integration test for this case.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: