当我做码头时:运行...正确的战争过滤器。 当我打包...由此产生的战争不能正确过滤。 我做错了什么?
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
</excludes>
</resource>
</resources>
<finalName>MyWarName</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>${jdk.source}</source>
<target>${jdk.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<contextXml>${basedir}/src/main/webapp/WEB-INF/jetty-context.xml</contextXml>
</configuration>
</plugin>
</plugins>
</build>
答案 0 :(得分:0)
您需要添加未替换的属性:
系统属性
项目属性:
<project>
...
<properties>
<the_name>value</value>
</properties>
...
</project>
使用.properties文件过滤构建:
<project>
...
<build>
<filters>
<filter>the_values.properties</filter>
</filters>
</build>
...
</project>