Maven:在战争爆发前清理webapp目录:爆炸了吗? [英] Maven: clean the webapp directory before war:exploded?

查看:106
本文介绍了Maven:在战争爆发前清理webapp目录:爆炸了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引用 maven war插件使用页面:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
          <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

在分解war文件之前,如何清理<webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory>中定义的目录的内容?

How do i clean the content of the directory defined in the <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory> before exploding the war file ?

根据我的经验,定义为webappDirectory的文件夹不会被清除,因此将包含属于webapp的不相关文件.

In my experience, the folder defined as the webappDirectory wont get cleaned, and so will have nonrelated files that was part of the webapp.

如果我可以在当前用于清理webappDirectory的当前命令中添加一些内容,这将很酷,

It'll be cool if i can add something to the current command im currently using to clean the webappDirectory, which is something like this :

mvn -o clean <cleanWebappDirectory here?> install war:exploded

谢谢!

推荐答案

您可能想看看添加

You may want to look at adding the maven clean plugin, specifying the requisite folder to be cleaned. Something like below... Note that the directory should be relative.

<build>
  [...]
  <plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
      <filesets>
        <fileset>
          <directory>sample/servlet/container/deploy/directory</directory>
          <includes>
            <include>*</include>
          </includes>
        </fileset>
      </filesets>
    </configuration>
  </plugin>
  [...]
</build>

这篇关于Maven:在战争爆发前清理webapp目录:爆炸了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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