Maven清理插件排除.cvsignore [英] Maven clean plugin exclude .cvsignore

查看:89
本文介绍了Maven清理插件排除.cvsignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我最初犯了一个错误,并在cvs信息库中提交了目标目录;我知道没有安全的方法可以从CVS中删除目录,因此我在其中放置了一个.cvsignore文件,基本上可以忽略所有内容(我不希望无法正确合并的开发人员提交他们的类...)

In my project I originally made a mistake and committed the target directory in the cvs repository; I know there is no safe way to remove a directory from CVS, so I put a .cvsignore file there to basically ignore everything (I don't want developers who aren't able to even merge properly to commit their classes...).

我的Jenkins CI引起了问题,因为我运行了干净的目标并进行了测试.基本上clean是在CVS更新之前运行的,因此它总是找到要更新的文件(被clean擦除的.cvsignore)并触发通常无用的构建.

The problem raises with my Jenkins CI, because I run clean and test goals; basically clean is run before CVS update, so it always finds a file to update (the .cvsignore that has been wiped by clean) and triggers an often useless build.

我认为要走的路是使用排除功能,但是我尝试了但没有成功:

I think the way to go is to use exclusions but I tried and did not work:

[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting file set: **************************/target (included: [**], excluded: [])

排除项配置为:

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <executions>
        <execution>
            <id>not-clean</id>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>target</directory>
                        <excludes>
                            <exclude>*cvsignore</exclude>
                        </excludes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
            <phase>initialize</phase>
            <goals>
                <goal>clean</goal>
            </goals>
        </execution>
    </executions>
</plugin>

推荐答案

您可以尝试将<excludeDefaultDirectories>设置为true,否则,我相信target文件夹将始终被删除.

You could try setting <excludeDefaultDirectories> to true, Otherwise, I believe target folder would always get deleted.

以下代码段对我有用.请注意,我已经将default-clean用作id.

The following code snippet works for me. Note that I have used default-clean as the id.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
                <execution>
                    <id>default-clean</id>
                    <configuration>
                        <excludeDefaultDirectories>true</excludeDefaultDirectories>
                        <filesets>
                            <fileset>
                                <directory>target</directory>
                                <excludes>
                                    <exclude>.cvsignore</exclude>
                                    <exclude>CVS</exclude>
                                    <exclude>CVS/**</exclude>
                                </excludes>
                                <followSymlinks>false</followSymlinks>
                            </fileset>
                        </filesets>
                    </configuration>
                    <phase>initialize</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

这篇关于Maven清理插件排除.cvsignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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