Reputation: 146
I have a spring boot maven project with a property file in which I need to replace the property value for spring.cloud.config.server.git.username
and spring.cloud.config.server.git.password
properties using mvn resources:resources, but the values are not replaced as I expected.
To try to find the cause I created a small project that only contains the property file and pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>demo</groupId>
<artifactId>resource-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>resource-demo</name>
<properties>
<java.version>1.8</java.version>
<a.name>placholder</a.name>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
Executing mvn resources:resources -Da.name="some name"
with the above pom, the ${a.name}
is not replaced, but when I remove the spring boot parent from the pom, the ${a.name}
is replaced.
Can anyone explain me what I am doing wrong here?
This is the content of the property file:
Hello ${a.name}.
Upvotes: 0
Views: 149
Reputation: 97447
In the documentation it is stated that you have to use @a.name@
instead of ${a.name}
.
Upvotes: 2