亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在自己的Maven插件中使用lamda“打破”安裝插件目標

在自己的Maven插件中使用lamda“打破”安裝插件目標

楊__羊羊 2021-04-16 18:19:25
我開始創建自己的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>


查看完整回答
反對 回復 2021-04-18
  • 1 回答
  • 0 關注
  • 194 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號