Maven plugin and build profiles

I have a Maven project (3.0.4) in which some external resources are processed and filtered using some properties defined in the profile.

When I run the build plugin (either manually or connected to a phase), it seems that maven-resource-plugin does not consider the profile specified on the command line to be active. Thus, tokens that relate to the properties defined in the specified profile are not replaced.

If I define an activeByDefault profile, it is considered active, even if another is specified on the command line ...

This is an example:

<plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.5</version> <executions> <execution> <id>copy-script</id> <phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target</outputDirectory> <resources> <resource> <directory>${basedir}/src/main/bash</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> ... <profiles> <profile> <id>staging</id> <properties> <remote.url>some_stag_value</remote.url> </properties> </profile> <profile> <id>prod</id> <properties> <remote.url>some_prod_value</remote.url> </properties> </profile> </profiles> 
+4
source share
1 answer

Try disabling your profile with ! :

 mvn groupId:artifactId:goal -P profile_you_want !default_profile 
+2
source

All Articles