還有誰比nexus的出品公司sonatype更了解maven的呢?so 戳下面的連接配接看reference
<a target="_blank" href="http://books.sonatype.com/mvnref-book/reference/index.html">http://books.sonatype.com/mvnref-book/reference/index.html</a>
archetype is a maven project templating toolkit - http://maven.apache.org/guides/introduction/introduction-to-archetypes.html
create project from archetype -- http://maven.apache.org/archetype/maven-archetype-plugin/usage.html
create your own archetype -- http://maven.apache.org/guides/mini/guide-creating-archetypes.html
maven 提供的一些archetypes -- http://maven.apache.org/archetype/maven-archetype-bundles/
profile可以讓我們定義一系列的配置資訊,然後指定其激活條件。這樣我們就可以定義多個profile,然後每個profile對應不同的激活條件和配置資訊,進而達到不同環境使用不同配置資訊的效果。
<a target="_blank" href="http://haohaoxuexi.iteye.com/blog/1900568">http://haohaoxuexi.iteye.com/blog/1900568</a>
可以通過兩種方式應用plugin,groupid:artifact:version:goal 或者使用plugin的prefix,例如下面的兩個command效果是一樣的。
mvn help:describe -dplugin=compiler -dmojo=compile -dfull
mvn org.apache.maven.plugins:maven-help-plugin:2.2:describe -dplugin=compiler -dmojo=compile -dfull
注意在maven中,一個插件目标(goal)也被認為是一個mojo
for example, let's say you have a goal display:time that
echos the current time to the commandline, and you want it to run in the process-test-resources phase to
indicate when the tests were started. this would be configured like so:
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:
${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即可
<a target="_blank" href="http://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html">http://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html</a>
注意在plugin命名時,maven-${prefix}-plugin 是apache的保留方式,具有知識産權,最好不要做違背知識産權的事(infringement)
用${prefix}-maven-plugin
<a target="_blank" href="http://maven.apache.org/guides/plugin/guide-java-plugin-development.html">http://maven.apache.org/guides/plugin/guide-java-plugin-development.html</a>