官网:
http://maven.apache.org/
点击Maven plugins
plugins
http://maven.apache.org/plugins/index.html
点击一个plugins 如compiler
http://maven.apache.org/plugins/maven-compiler-plugin/
通过Goals Overview可以查看目标
再点击Source Repository可以查看下载源码的方法
点击Examples下的链接可以查看如何使用
如source插件可以对源码打包
http://maven.apache.org/plugins/maven-source-plugin/
编辑pom.xml
... ... org.apache.maven.plugins maven-source-plugin 2.2.1
pom.xml--右键--Run As -- Maven build -- 在golas输入source:jar-no-fork -- Run
这样就打出个源码包
如果在parent中配置
org.apache.maven.plugins maven-source-plugin 2.2.1 package jar-no-fork
另一个常用的插件help
http://maven.apache.org/plugins/maven-help-plugin/
help:describe把一个插件的信息显示出来
# mvn help:describe -DgroupId=org.somewhere -DartifactId=some-plugin -Dversion=0.0.0
如:
mvn help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-compiler-plugin -Dversion=3.1
或者
pom.xml--右键--Run As -- Maven build -- 在golas输入help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-compiler-plugin -Dversion=3.1
-- Run
输入
[INFO] org.apache.maven.plugins:maven-compiler-plugin:3.1 Name: Maven Compiler Plugin Description: The Compiler Plugin is used to compile the sources of your project. Group Id: org.apache.maven.plugins Artifact Id: maven-compiler-plugin Version: 3.1 Goal Prefix: compiler This plugin has 3 goals: compiler:compile Description: Compiles application sources compiler:help Description: Display help information on maven-compiler-plugin. Call mvn compiler:help -Ddetail=true -Dgoal=to display parameter details. compiler:testCompile Description: Compiles application test sources. For more information, run 'mvn help:describe [...] -Ddetail'
help简化的写法:
http://maven.apache.org/plugins/maven-help-plugin/examples/describe-configuration.html
help:describe -Dplugin=source
sql插件,可以执行sql
http://mojo.codehaus.org/sql-maven-plugin/
UTF-8 4.10 com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/mysql root password
org.codehaus.mojo sql-maven-plugin 1.5 mysql mysql-connector-java 5.1.18 ${mysql.driver} ${mysql.url} ${mysql.username} ${mysql.password} create database IF NOT EXISTS maven_test package execute
pom.xml--右键--Run As -- Maven build -- 在golas输入clean package
rar插件,可以打rar包
org.apache.maven.plugins maven-rar-plugin 2.2 package rar
pom.xml--右键--Run As -- Maven build -- 在golas输入clean package
参考:
http://www.infoq.com/cn/news/2011/04/xxb-maven-7-plugin