I have Maven multi-module project with such structure:
parent-pom-project
-- module1
-- module2
At the parent-pom-project I have such pom.xml
<modules>
<module>module1</module>
</modules>
...
<profiles>
<profile>
<id>local</id>
<properties>
<prop>local_prop</prop>
</properties>
</profile>
<profile>
<id>test</id>
<modules>
<module>module2</module>
</modules>
<properties>
<prop>test_prop</prop>
</properties>
</profile>
</profiles>
At all pom.xml files I have such tag:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
At module1 and module2 in resource directory I have properties files with such text:
prop=${prop}
The problem is that after
mvn clean install
or
mvn clean install -Ptest
or even
mvn clean install -P test
I get
prop=local_prop
If I user test profile for build module2 is also builded, but properties are used from local profile. I use Maven 3.0.3. Anybody have any ideas?
in the pom. xml properties , try to get auto-completion/suggestion to override a parent property using CTRL+O (like override method in Java), CTRL+SPACE(+SPACE) (open auto-completion/suggestion) or ALT+INSERT (insert Managed Dependency, Dependency Template...)
A profile in Maven is an alternative set of configuration values which set or override default values. Using a profile, you can customize a build for different environments. Profiles are configured in the pom. xml and are given an identifier.
You could try to use the mvn help:effective-pom -Ptest command to see the paramters used in your build.
See http://maven.apache.org/plugins/maven-help-plugin/plugin-info.html for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With