我开始创建自己的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>
1 回答
慕沐林林
TA贡献2016条经验 获得超9个赞
要在我的maven插件中使用lamda,我必须在最新版本(以我的情况为3.5)中使用maven-plugin-plugin,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5</version>
</plugin>
添加回答
举报
0/150
提交
取消