5

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 プロジェクトです。この春の mvc maven プロジェクト用に .war ファイルを作成しています。これらのファイルを除外する必要がありますが、機能していません。

ポインタはありますか?

4

2 に答える 2

10

試してみました...正しい場所で設定を行っていますか? 私のポンは次のようになります:

<?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>
于 2013-04-22T03:42:17.037 に答える
2

これを追加pom.xml

</build>
  <resources>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
                <exclude>web.properties</exclude>
            </excludes
        </resource>
  </resources>
</build>
于 2013-04-22T03:39:53.343 に答える