gpt4 book ai didi

Maven src/main/resources 不过滤

转载 作者:行者123 更新时间:2023-12-05 08:00:35 27 4
gpt4 key购买 nike

当我执行 jetty:run 时...生成的 war 过滤器正确。当我打包时...由此产生的 war 无法正确过滤。我做错了什么?

  <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>

最佳答案

您需要添加未被替换的属性:

系统属性

项目属性:

<project>
...
<properties>
<the_name>value</value>
</properties>
...
</project>

使用 .properties 文件构建过滤器:

<project>
...
<build>
<filters>
<filter>the_values.properties</filter>
</filters>
</build>
...
</project>

关于Maven src/main/resources 不过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18032848/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com