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

问题描述 投票:0回答:1

我想排除标有红线的文件夹。我该怎么做?

这是我的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配置做什么吗?

java maven maven-2 maven-plugin maven-assembly-plugin
1个回答
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有关。

© www.soinside.com 2019 - 2024. All rights reserved.