简体   繁体   中英

How to exclude folder with files from war maven assembly

I wanna exclude folder marked with red line. How can I do it?
在此处输入图片说明

Here is my pom.xml:

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>Test</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<url>http://maven.apache.org</url>
    <properties>
        <spring-version>4.1.0.RELEASE</spring-version>
        <spring-security-version>3.2.3.RELEASE</spring-security-version>
        <hibernate-version>4.3.4.Final</hibernate-version>
    </properties>

    <dependencies>
        <!-- a lot of dependencies -->
    </dependencies>
<build>
    <finalName>Test</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

Should I do anything with maven-compiler-plugin configuration?

This should give you the answer you need: http://maven.apache.org/plugins/maven-war-plugin/examples/including-excluding-files-from-war.html

Here is an example where we exclude all JAR files from WEB-INF/lib:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

This doesn't have anything to do with the maven compiler plugin, but the maven war plugin .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM