maven2:从WAR中排除目录 [英] maven2: excluding directory from WAR

查看:197
本文介绍了maven2:从WAR中排除目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了从我的WAR文件中排除整个目录($ {basedir}/src/main/webapp/webscripts),但失败.怎么了?

I tried this to exclude whole directory (${basedir}/src/main/webapp/webscripts) from my WAR file but it failed. What is wrong?

这不起作用:

<configuration>
   <webResources>
      <resource>
       <directory>${basedir}/src/main/webapp/webscripts</directory>
       <excludes>
        <exclude>**/*.*</exclude>
       </excludes>
      </resource>
   </webResources>
</configuration>

这也是:

<configuration>
   <webResources>
      <resource>
       <directory>${basedir}/src/main/webapp</directory>
       <excludes>
        <exclude>**/webscripts</exclude>
       </excludes>
      </resource>
   </webResources>
</configuration>

有人可以帮忙吗?

推荐答案

您的两个解决方案都无济于事,因为它们会添加一个额外的资源,然后将其停用.默认情况下,不使用资源机制复制webapp源文件夹.

Both of your solutions wouldn't help, as they would add an additional resource that is then deactivated. The webapp source folder is copied by default, without the resource mechanism.

停用其中一部分的机制是通过 <warSourceExcludes> 参数,如下所示:

The mechanism to deactivate a part of that is through the <warSourceExcludes> parameter, like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1</version>
    <configuration>
        <warSourceExcludes>webscripts/**</warSourceExcludes>
    </configuration>
</plugin>

这篇关于maven2:从WAR中排除目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆