Skip to content

[SUREFIRE-1385] System properties defined in the Surefire and Failsafe plugin configuration should override user properties #2304

@jira-importer

Description

@jira-importer

Guillaume Boué opened SUREFIRE-1385 and commented

Consider a build with the following POM configuration for the Maven Failsafe Plugin:

<configuration>
  <systemPropertyVariables>
    <prop>foo</prop>
  </systemPropertyVariables>
</configuration>

When running the build with the command line mvn -Dprop=bar ..., the tests would be passed a system property with a value of bar instead of foo.

This is counter-intuitive since direct configuration of the plugin is overriden by the more general properties passed on the command line. I would have expected the closer definition in the POM to override the one passed with the CLI. Furthermore, in the case of the above sample, it would not be possible for the tests run by the Failsafe Plugin to have a system property prop with a value of foo if the build happens to already define a system property with the same name. While using a different name to avoid a clash is possible, it still doesn't make the test self-contained and consistent since anyone could run Maven with that other name and compromise the test that really relies on the system property having a value of foo.

The proposal is thus to make the systemPropertyVariables and systemPropertiesFile configuration elements of the Surefire and Failsafe Plugin take precedence over user properties passed on the command line.

Proposed commit 4de017b38b101b0b28f9fbed135eae3921b99d0d on SUREFIRE-1385 branch.


Affects: 2.20

Issue Links:

  • MASFRES-70 ITs in ASF Jenkins use wrong artifact for testing
    ("causes")
  • SUREFIRE-121 System properties set on the command line get clobbered

Remote Links:

0 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions