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

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

我应该对 ma​​ven-compiler-plugin 配置做些什么吗?

最佳答案

这应该会给您所需的答案: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>

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

关于java - 如何从 war Maven 程序集中排除包含文件的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28353473/

相关文章:

hibernate - 仅创建和清理数据库设置一次以测试所有 DAO

java - 类路径和资源问题

java - 尝试用maven创建spring项目

java - 从其他位置加载 JAR 有多困难?

java - 加入mysql特有的ROW_FORMAT=DYNAMIC jooq生成的建表语句

java - 如何在 @ComponentScan 中定义另一个模块中 java 类的路径?

java - AEM Maven 无法执行安装 com.day.jcr.vault :content-package-maven-plugin

java - 如何在pom.xml中设置Jmeter home?

java - (TensorflowLite/Android) 无法实例化 Activity ComponentInfo

java - 为什么 OpenJDK 8 在使用 Docker 时没有提取正确的 JavaFX 库?