I'm trying to use the 72.1.1 Automatic property expansion using Maven as specified in the documentation using different maven profiles, but I'm not able to make it work with specific profiles.
I have the following pom.xml
:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<profiles>
<profile>
<id>local</id>
<activation>
<property>
<name>profileName</name>
<value>local</value>
</property>
</activation>
<properties>
<wildcard.for.customproperty>valueA</wildcard.for.customproperty>
</properties>
</profile>
<profile>
<id>external</id>
<activation>
<property>
<name>profileName</name>
<value>external</value>
</property>
</activation>
<properties>
<wildcard.for.customproperty>valueB</wildcard.for.customproperty>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.9.RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
And this very simple application.properties
:
custom.property=@wildcard.for.customproperty@
I run the maven build with Spring Tool Suite with the following goals:
clean install -DprofileName=local
The build SUCCESS, but the application.properties
in target folder still contains the unresolved @...@
placeholder.
If I add this simple line in the pom.xml in one of the two profiles:
<activeByDefault>true</activeByDefault>
The placeholder is correctly resolved.
What's wrong with this configuration?