Hi Folks,
I have some tests running that read a system property to determine where some
resources should be read from. I've defined that property inside a master pom
file, and created profiles that activate that property on other projects pom
files. The structure is somehow like this:
master-pom-folder
|-master-pom.xml
|-submodule-folder
|-submodule-pom.xml
|-test-project
|-test-pom.xml
In the master pom file, I've the following:
<properties>
<mycompany.localTestData>/temp/testdata/</mycompany.localTestData>
</properties>
[...]
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</pluginManagement>
</build>
[...]
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<mycompany.testRoot>${mycompany.localTestData}</mycompany.testRoot>
</systemPropertyVariables>
<argLine>-Dmycompany.testRoot=${mycompany.localTestData}</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
The submodule-pom.xml is just a parent for all project it contains, and it
inherits from this master-pom. The test-pom.xml inherits from the
submodule-pom.xml.
Running effective-pom with the release profile activated over the
submodule-pom.xml and test-pm.xml tells me that the configuration for surefire
plugin is correct, for instance:
<build>
[...]
<plugins>
[...]
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>target/test-classes</additionalClasspathElement>
</additionalClasspathElements>
<systemPropertyVariables>
<mycompany.testRoot>/temp/testdata/</mycompany.testRoot>
</systemPropertyVariables>
<argLine>-Dmycompany.testRoot=/temp/testdata/</argLine>
</configuration>
</plugin>
[...]
However, when I try release:prepare release:perform with that profile activated
on the submodule-pom.xml, the execution of the tests seems to be ignoring those
settings. When tests read the system property "mycompany.testRoot" using
System.getProperty it comes null, and the default value gets set. You can note
that I have even tried different approches, using systemPropertyVariables and
later argLine, and end up leaving both in the profile. Any thoughts on what
might be happening? Am I missing something?
Kind regards,
Felipe Roos
http://www.linkedin.com/in/feliperoos
Achar desculpas para os nossos
defeitos não nos torna melhores
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]