I'm generating a project from an archetype and I have a property in pom of this generated project (archetype-resources/pom):
<properties>
<myProperty>productionValue</myProperty>
</properties>
and the following surefire configuration:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>
-Djava.library.path=${myProperty}
</argLine>
</configuration>
</plugin>
I want myProperty
to be overridden with value from my archetype pom when I run ITs and stay the same when users generate this project. How do I do that?
I tried setting it in archetype.properties
file, but it has a variable in it:
myProperty=${project.basedir}/IT/path
.
I want ${project.basedir}
to be a basedir of archetype project in case of ITs, not of generated project, which is not the case when I do it like that.
Another way I tried is to use plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>${maven-archetype.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<properties>
<myProperty>${project.basedir}/IT/path</myProperty>
</properties>
</configuration>
</execution>
</executions>
</plugin>
But it didn't work as well, myProperty
in pom of generated project is not changed. What is it that I'm doing wrong? Thank you so much for your help!
The problem was that I have put
<configuration>
<properties>
<myProperty>${project.basedir}/IT/path</myProperty>
</properties>
</configuration>
under <execution>
tag and not <plugin>
. After I did that it worked as expected.