【问题标题】:Does Maven Mojo have Equivalent to ant's DirSet?Maven Mojo 是否具有等效于 ant 的 DirSet?
【发布时间】:2015-04-01 14:14:42
【问题描述】:
我正在将一个 ant 插件升级为 maven 插件,我的 ant 插件使用了 DirSet,我看到 maven 只有一个 FileSet。
- 我可以使用 FileSet 来收集目录吗?
- 我是否应该通过查看 Ant 的 PatternSet - DirSet 代码来创建自己的 dirset 类,然后使用 maven 的 PatternSet 和/或 FileSet 实现类似的解决方案?
- 有没有更好的方法来收集包含和排除的目录?
感谢您的帮助
彼得
【问题讨论】:
标签:
maven
maven-plugin
maven-mojo
【解决方案1】:
在Maven's File Management examples 页面上找到它。
FileSetManager fileSetManager = new FileSetManager();
String[] includedFiles = fileSetManager.getIncludedFiles( fileset );
String[] includedDir = fileSetManager.getIncludedDirectories( fileset );
String[] excludedFiles = fileSetManager.getExcludedFiles( fileset );
String[] excludedDir = fileSetManager.getExcludedDirectories( fileset );
fileSetManager.delete( fileset );