java – maven-clean-plugin没有删除所有给定的目录
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – maven-clean-plugin没有删除所有给定的目录,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2733字,纯文字阅读大概需要4分钟。
内容图文
![java – maven-clean-plugin没有删除所有给定的目录](/upload/InfoBanner/zyjiaocheng/734/ffc50ae054ea4b37b61a399a8419c8f0.jpg)
在我的项目.pom中,我设置了maven-clean-plugin,如下所示:
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/bower_components</directory>
</fileset>
<fileset>
<directory>node_modules</directory>
</fileset>
<fileset>
<directory>node</directory>
</fileset>
</filesets>
</configuration>
</plugin>
插件的目的是删除由frontend-maven-plugin创建的目录.无论如何,最后一个工作正常.
问题
现在的问题是,无论如何,永远不会删除上述文件夹之一.它始终是“中间的”.我添加了3个文件集,并且第二个文件集总是没有删除,请参阅日志:
[INFO] Deleting /src/main/webapp/bower_components (includes = [], excludes = [])
[INFO] Deleting /node_modules (includes = [.bindings], excludes = [])
[INFO] Deleting /node (includes = [], excludes = [])
如果我更改文件夹的顺序:
[INFO] Deleting /src/main/webapp/bower_components (includes = [], excludes = [])
[INFO] Deleting /node (includes = [.bindings], excludes = [])
[INFO] Deleting /node_modules (includes = [], excludes = [])
而且第二个选项总是包含这个部分:includes = [.bindings]我认为该文件夹没有被删除.
为什么会发生这种情况,以及如何解决这个问题?
编辑,调试日志
mvn -X clean结果,我认为这是它破坏的地方:
解析pom.xml后,它会使用此参数读取配置.但是,我没有把它放在那里.
解决方法:
好的,我发现了这个问题!它实际上是插件中的一个错误,已经报告过了.它会影响maven-clean-plugin 2.6.1.
这是我的错误配置,继续阅读决议.
情况
你有一个父项目和一个子项目,都必须使用该插件.
现在;
>在父项目中指定一些文件集.
>在子项目中指定一些文件集.
我认为是预期的:
插件读取父项和子项的文件集并清除它们.
怎么了:
插件使用子文件集覆盖父文件集.文件集按顺序覆盖.但是,不清除文件集的父配置!
我的情况:
父.pom:
<filesets>
<fileset>
<directory>test-output</directory>
</fileset>
<fileset>
<directory>${basedir}/</directory>
<includes>
<include>.bindings</include>
</includes>
</fileset>
</filesets>
Childs pom:
<filesets>
<fileset>
<directory>node</directory>
</fileset>
<fileset>
<directory>node_modules</directory>
</fileset>
<fileset>
<directory>src/main/webapp/bower_components</directory>
</fileset>
</filesets>
并借鉴以上信息;插件读取的配置是:
<filesets>
<fileset>
<directory>node</directory>
</fileset>
<fileset>
<directory>node_modules</directory>
<includes>
<include>.bindings</include>
</includes>
</fileset>
<fileset>
<directory>src/main/webapp/bower_components</directory>
</fileset>
</filesets>
而不是具有5个文件集的配置.
错误报告https://issues.apache.org/jira/browse/MCLEAN-64
解决
For configuration there are some magic attributes to instruct how xml elements should be combined. In this case add combine.children=”append” to the filesets tag. More details about this can be found on the POM Reference page. 07001
值得一提的是,在child的项目.pom中设置combine.children =“append”就足够了.
内容总结
以上是互联网集市为您收集整理的java – maven-clean-plugin没有删除所有给定的目录全部内容,希望文章能够帮你解决java – maven-clean-plugin没有删除所有给定的目录所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。