使用pom文件从目标目录中删除或删除资源文件 [英] Remove or delete resource files from target directory using pom file

查看:986
本文介绍了使用pom文件从目标目录中删除或删除资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在pom.xml中有两个配置文件,并且有一些资源文件已添加到目标资源目录中:${project.build.outputDirectory}/resources在执行第一个配置文件期间.我需要做的是在第二个配置文件执行期间删除那些资源文件. 有什么方法可以从目标目录中删除或删除现有文件?

I have two profiles in pom.xml, and I have some resource files which I have added into target resource directory: ${project.build.outputDirectory}/resources during execution of the first profile. What I need to do is remove those resource files during execution of the second profile. Is there any way to remove or delete existing files from target directory?

推荐答案

我已经解决了.. !!

I got the solution..!!

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
    <execution>
        <phase>test</phase>
        <goals>
            <goal>run</goal>
        </goals>
        <configuration>
            <tasks>
                <delete>
                    <fileset dir="${project.build.outputDirectory}/resources" includes="*.xml" />
                </delete>
            </tasks>
        </configuration>
    </execution>
</executions>
</plugin>

供参考- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html

这篇关于使用pom文件从目标目录中删除或删除资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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