謝謝emeraldjava,這給了我足夠的解決我的問題的答案。
叢-utils的有一個名爲fileutils中的實用工具類,你可以在上面添加一個依賴這樣的:
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.1</version>
</dependency>
一旦你有文件實用程序,你可以由此實現FileSetTransformer:
public final class FileSetTransformer {
private FileSetTransformer() {
}
public static List<File> toFileList(FileSet fileSet) {
File directory = new File(fileSet.getDirectory());
String includes = toString(fileSet.getIncludes());
String excludes = toString(fileSet.getExcludes());
return FileUtils.getFiles(directory, includes, excludes);
}
private static String toString(List<String> strings) {
StringBuilder sb = new StringBuilder();
for (String string : strings) {
if (sb.length() > 0)
sb.append(", ");
sb.append(string);
}
return sb.toString();
}
}
來源
2009-01-25 00:03:16
Tom