我开始创建自己的Maven插件。一切都很好,并且使用了maven的文档。
现在,我创建了一个新类,在其中我要对列表进行排序:
公共类VersionResolver {
File file;
public VersionResolver(String path) {
...
}
public List<String> getAvailableOrderedVersions(){
File[] versionFolders = file.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.startsWith("v");
}
});
List<String> versions = new ArrayList<String>();
for (File f :versionFolders) {
if (f.isDirectory()){
versions.add(f.getName().replace("v", ""));
}
}
Comparator<String> comparator = new Comparator<String>() {
public int compare(String v1, String v2) {
.....(code not really relevant)...
}
};
Collections.sort(versions, comparator);
return versions;
}
多亏了lamda,它可以像这样完成:
versions.sort((v1, v2) -> {
....
});
之后,当我执行mvn安装时,出现错误消息:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project lsg-installer-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor failed: 52264 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
我的父母pom有:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
慕沐林林
相关分类