这是我在一个简单项目中的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 http://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.1.7.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>test</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<filters>
<filter>src/main/resources/filters/test.filter</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources/export</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>这是我的资源
src/main/resources/export/app.properties
Hello ${test_prop}src/main/resources/filters/test.filter
test_prop = World当我运行mvn resources:resources或mvn clean package时,目标文件夹中的结果是原始的mvn clean package(没有过滤)。有人知道为什么它没有过滤吗?
发布于 2019-09-24 00:49:32
从Spring文档:如果您使用spring starter父程序,那么您可以使用@.占位符引用您的Maven 'project属性‘,如下面的示例所示:
app.encoding=@project.build.sourceEncoding@
app.java.version=@java.version@https://stackoverflow.com/questions/57713510
复制相似问题