簡體   English   中英

Maven 從父 pom 中的命令行調用插件

[英]Maven calling plugin from command line in parent pom

我的項目結構:

 - something-parent -- something-one -- something-two

something-parent -> pom.xml

 <packaging>pom</packaging> <modules> <module>something-one</module> <module>something-two</module> </modules> <build> <plugins> <plugin> <groupId>io.github.something</groupId> <artifactId>something-maven-plugin</artifactId> <version>1.0.0</version> </plugin> </plugins> </build>

現在我想執行mvn something:help ,但我不能: No plugin found for prefix 'something'

如果我刪除modules部分 - 它有效。 它也適用於其他模塊。

它只是在帶有modules部分的父模塊中不起作用。 我找不到任何文檔或任何描述此內容的字面意思,這是故意的嗎? 有什么解決方法嗎?

我知道io.github.something:something-maven-plugin:1.0.0:help會工作,但我需要快捷方式版本才能工作。

//Edit1 - 我知道settings.xml解決方案,但它需要用戶手動編輯,我想要項目級別的東西

//Edit2 - 發現了另一個怪癖,當我做mvn something:help -N時它起作用了

我知道您想在從命令行調用插件時使用短名稱來引用它。 為此,您必須在 settings.xml 中定義一個插件組,截至https://maven.apache.org/settings.html#plugin-groups在您的情況下它將是:

<pluginGroups>
   <pluginGroup>io.github.something</pluginGroup>
</pluginGroups>

這允許您調用:

mvn something:goal

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM