maven Clean插件排除.cvsignore
题
在我的项目中,我最初犯了一个错误,并在CVS存储库中犯了目标目录。我知道没有安全的方法可以从CVS中删除目录,因此我将.cvSignore文件放在那里,以基本忽略所有内容(我不希望无法正确合并以完成他们的课程的开发人员...) 。
我的Jenkins CI提出了问题,因为我运行干净和测试目标;基本上清洁是在CVS更新之前运行的,因此它总是找到要更新的文件(已被清洁擦除的.cvSignore),并触发通常毫无用处的构建。
我认为要走的方法是使用排除措施,但我尝试过并且无效:
[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
文件夹将始终被删除。
以下代码段对我有用。请注意我已经使用过 default-clean
作为 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>
不隶属于 StackOverflow