... <plugin> <groupId>com.mycompany.example</groupId> <artifactId>display-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <phase>process-test-resources</phase> <goals> <goal>time</goal> </goals> </execution> </executions> </plugin> ...
怎樣經過Prefix找到你的Plugin (Plugin Prefix Resolution)
By default, Maven will make a guess at the plugin-prefix to be used, by removing any instances of "maven" or "plugin" surrounded by dashes in the plugin's artifact ID. The conventional artifact ID formats to use are:html
- maven-${prefix}-plugin - for official plugins maintained by the Apache Maven team itself (you must not use this naming pattern for your plugin, see this note for more informations)
- ${prefix}-maven-plugin - for plugins from other sources
By default, Maven will search the groupId org.apache.maven.plugins for prefix-to-artifactId mappings默認,Maven會搜索apache groupId (repository)去匹配與prefix相符的plugin(用上面提到的規則),若是想把本身開發的plugin或第三方plugin也設置爲搜索目標,咋辦尼?很簡單,在~/.m2/settings.xml中加入pluginGroup便可<pluginGroups> <pluginGroup>com.alibaba.org.apache.maven.plugins</pluginGroup> <pluginGroup>com.alibaba.maven.plugins</pluginGroup> </pluginGroups>
開發本身的Plugin
注意在Plugin命名時,maven-${prefix}-plugin 是Apache的保留方式,具備知識產權,最好不要作違背知識產權的事(infringement)
用${prefix}-maven-plugin
版權聲明:本文爲博主原創文章,未經博主容許不得轉載。java