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

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

问题描述

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

这不起作用:

<预><代码><配置><网络资源><资源><目录>${basedir}/src/main/webapp/webscripts</directory><排除><排除>**/*.*</exclude></排除></资源></webResources></配置>

这也是:

<预><代码><配置><网络资源><资源><目录>${basedir}/src/main/webapp</directory><排除><exclude>**/webscripts</exclude></排除></资源></webResources></配置>

有人可以帮忙吗?

解决方案

你的两个解决方案都无济于事,因为它们会添加一个额外的资源,然后被停用.webapp源文件夹默认复制,没有资源机制.

停用其中一部分的机制是通过 参数,像这样:

<groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.1</version><配置><warSourceExcludes>webscripts/**</warSourceExcludes></配置></插件>

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

this doesn't work:

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

this too:

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

Can anybody help?

解决方案

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.

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天全站免登陆