从webapp/WEB-INF/lib中排除所有jar

Arp*_*pit 1 maven maven-war-plugin

我在我的WEB项目中放置了第三方jar /src/main/webapp/WEB-INF/lib/

我已经在pom.xml中提到了所有必需 JAR的依赖关系.现在,由于依赖关系是在POM中定义的,因此JAR将自动打包在文件夹中.lib

  • 我想排除所有的JAR lib.
  • 在构建WAR时,应将依赖JAR打包在lib中

我不能LIB从WEB-INF中删除它,因为它用于本地开发

这是我到目前为止所尝试的:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <packagingExcludes>META-INF/context.xml</packagingExcludes>
    <webResources>
      <resource>
        <directory>src/main/webapp/WEB-INF/lib</directory>
        <excludes>
          <exclude>**/**</exclude>
        </excludes>
      </resource>
    </webResources>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

任何的想法?

rav*_*don 6

它应该是"packagingExcludes"而不是"warSourceExcludes":

<configuration>
    <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
    ....
</configuration>
Run Code Online (Sandbox Code Playgroud)

来自http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html:

在版本2.1-alpha-1中,这被错误地命名为warSourceExcludes