如何从war maven程序集中排除包含文件的文件夹

时间:2015-02-05 20:31:44

标签: java maven maven-2 maven-plugin maven-assembly-plugin

我想排除标有红线的文件夹。我该怎么办? enter image description here

这是我的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>

我应该对 maven-compiler-plugin 配置做什么吗?

1 个答案:

答案 0 :(得分:1)

这可以为您提供所需的答案:http://maven.apache.org/plugins/maven-war-plugin/examples/including-excluding-files-from-war.html

  

以下是我们从WEB-INF / lib中排除所有JAR文件的示例:

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

这与maven编译器插件没有任何关系,只有maven war plugin