[英]How to exclude resources from my maven build, packagingExcludes not working
我正在使用maven-war-plugin來構建.war文件
我正在使用packagigExcludes,它適用於.jar文件:
<packagingExcludes>WEB-INF/lib/jetty-*.ja
WEB-INF/../resources/log4j.properties,
WEB-INF/../resources/web.properties
</packagingExcludes>
但上面的屬性文件沒有被排除在外,我也嘗試過:
src/main/resources/web.properties
這是一個多模塊maven項目,我正在為這個spring mvc maven項目構建一個.war文件,我必須排除這些文件,但它不起作用。
有什么指針嗎?
我剛試過......你確定你在正確的位置進行配置嗎? 我的pom看起來像這樣:
<?xml version="1.0"?>
<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>com.example</groupId>
<artifactId>example-parent</artifactId>
<version>0.1.4-SNAPSHOT</version>
</parent>
<artifactId>example-webapp</artifactId>
<packaging>war</packaging>
<url>http://maven.apache.org</url>
<dependencies>
[...]
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
<finalName>example-webapp</finalName>
</build>
</project>
---->編輯
要從資源中排除內容,您必須這樣做:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<packagingExcludes>
WEB-INF/classes/log4j.properties
</packagingExcludes>
</configuration>
</plugin>
在pom.xml
添加它
</build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>web.properties</exclude>
</excludes
</resource>
</resources>
</build>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.