Plugins
    
   
    Plugin是Maven的核心,所有功能的实现是通过插件完成。Maven提供了很多插件,也有第三方提供。参考:
    
     
      http://maven.apache.org/plugins/index.html
      
       
      
     
    
    ,几个比较常用的插件:
   
- Maven Archetype Plugin
- Maven Eclipse Plugin
- Maven Compiler Plugin
- Maven xdoclet Plugin
- Maven Source Plugin
- Maven Javadoc Plugin
- Maven SCM
- Maven AntRun Plugin
- Maven Dependency Plugin
- Maven Release Plugin
- Maven Assembly Plugin
    
   
    
    
    
     Maven Archetype Plugin
    
   
    Maven Archetype Plugin用来创建maven项目的模板即archetype,也可以从一个项目创建一个archtype,
    
    参考:
    
     
      http://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html
      
       
      
     
    
   
    
    
    
     Goals:
    
   
    
     
      
      
     
    
    
     archetype:create
    
    
     
    
    
     Deprecated.
    
    Please use the generate mojo instead.
    
    
     
      
      
     
    
    
     archetype:create-from-project
    
    
     
    
    Creates an archetype from the current project.
    
    
     
      
      
     
    
    
     archetype:generate
    
    
     
    
    Generates a new project from an archetype.
    
    
     
      
      
     
    
    
     archetype:help
    
    
     
    
    Display help information on maven-archetype-plugin. Call
    
    mvn archetype:help -Ddetail=true -Dgoal=<goal-name>
    
    to display parameter details.
   
    
    
    
     Usage:
    
   
    
    
    创建简单的maven项目
   
    mvn archetype:create \
    
    -DarchetypeGroupId=org.apache.maven.archetypes \
    
    -DarchetypeArtifactId=maven-archetype-webapp \
    
    -DgroupId=com.mycompany.app \
    
    -DartifactId=my-webapp
   
    
    
    创建简单的webapp项目
   
    mvn archetype:create \
    
    -DarchetypeGroupId=org.apache.maven.archetypes \
    
    -DarchetypeArtifactId=maven-archetype-webapp \
    
    -DgroupId=com.mycompany.app \
    
    -DartifactId=my-webapph4.3.创建复杂的maven项目
    
    mvn archetype:generate -DarchetypeCatalog=internal
    
    通过指定archetypeCatalog参数,从指定的参数中选择需要创建的项目,参数定义见参考。如:
    
    E:\workspaces>mvn archetype:generate -DarchetypeCatalog=internal
    
    [INFO] Scanning for projects…
    
    [INFO]
    
    [INFO] ————————————————————————
    
    [INFO] Building Maven Stub Project (No POM) 1
    
    [INFO] ————————————————————————
    
    [INFO]
    
    [INFO] >>> maven-archetype-plugin:2.0-alpha-5:generate (default-cli) @ standalon
    
    e-pom >>>
    
    [INFO]
    
    [INFO] <<< maven-archetype-plugin:2.0-alpha-5:generate (default-cli) @ standalon
    
    e-pom <<<
    
    [INFO]
    
    [INFO] — maven-archetype-plugin:2.0-alpha-5:generate (default-cli) @ standalon
    
    e-pom —
    
    [INFO] Generating project in Interactive mode
    
    [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.
    
    archetypes:maven-archetype-quickstart:1.0)
    
    Choose archetype:
    
    1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web applicati
    
    on with Hibernate, Spring and JSF)
    
    2: internal -> appfuse-basic-spring (AppFuse archetype for creating a web applic
    
    ation with Hibernate, Spring and Spring MVC)
    
    3: internal -> appfuse-basic-struts (AppFuse archetype for creating a web applic
    
    ation with Hibernate, Spring and Struts 2)
    
    4: internal -> appfuse-basic-tapestry (AppFuse archetype for creating a web appl
    
    ication with Hibernate, Spring and Tapestry 4)
    
    5: internal -> appfuse-core (AppFuse archetype for creating a jar application wi
    
    th Hibernate and Spring and XFire)
    
    6: internal -> appfuse-modular-jsf (AppFuse archetype for creating a modular app
    
    lication with Hibernate, Spring and JSF)
    
    7: internal -> appfuse-modular-spring (AppFuse archetype for creating a modular
    
    application with Hibernate, Spring and Spring MVC)
    
    8: internal -> appfuse-modular-struts (AppFuse archetype for creating a modular
    
    application with Hibernate, Spring and Struts 2)
    
    9: internal -> appfuse-modular-tapestry (AppFuse archetype for creating a modula
    
    r application with Hibernate, Spring and Tapestry 4)
    
    10: internal -> makumba-archetype (Archetype for a simple Makumba application)
    
    11: internal -> maven-archetype-j2ee-simple (A simple J2EE Java application)
    
    12: internal -> maven-archetype-marmalade-mojo (A Maven plugin development proje
    
    ct using marmalade)
    
    13: internal -> maven-archetype-mojo (A Maven Java plugin development project)
    
    14: internal -> maven-archetype-portlet (A simple portlet application)
    
    15: internal -> maven-archetype-profiles ()
    
    16: internal -> maven-archetype-quickstart ()
    
    17: internal -> maven-archetype-site-simple (A simple site generation project)
    
    18: internal -> maven-archetype-site (A more complex site project)
    
    19: internal -> maven-archetype-webapp (A simple Java web application)
    
    20: internal -> data-app (A new Databinder application with sources and resource
    
    s.)
    
    21: internal -> camel-archetype-component (Creates a new Camel component)
    
    22: internal -> camel-archetype-activemq (Creates a new Camel project that confi
    
    gures and interacts with ActiveMQ)
    
    23: internal -> camel-archetype-java (Creates a new Camel project using Java DSL
    
    )
    
    24: internal -> camel-archetype-scala (Creates a new Camel project using Scala D
    
    SL)
    
    25: internal -> camel-archetype-spring (Creates a new Camel project with added S
    
    pring DSL support)
    
    26: internal -> camel-archetype-war (Creates a new Camel project that deploys th
    
    e Camel Web Console, REST API, and your routes as a WAR)
    
    27: internal -> jini-service-archetype (Archetype for Jini service project creat
    
    ion)
    
    28: internal -> jbosscc-seam-archetype (Maven Archetype to generate a Seam Appli
    
    cation- Documentation)
    
    29: internal -> softeu-archetype-seam (JSF+Facelets+Seam Archetype)
    
    30: internal -> softeu-archetype-seam-simple (JSF+Facelets+Seam (no persistence)
    
    Archetype)
    
    31: internal -> softeu-archetype-jsf (JSF+Facelets Archetype)
    
    32: internal -> jpa-maven-archetype (JPA application)
    
    33: internal -> spring-osgi-bundle-archetype (Spring-OSGi archetype)
    
    34: internal -> bamboo-plugin-archetype (Atlassian Bamboo plugin archetype)
    
    35: internal -> confluence-plugin-archetype (Atlassian Confluence plugin archety
    
    pe)
    
    36: internal -> jira-plugin-archetype (Atlassian JIRA plugin archetype)
    
    37: internal -> maven-archetype-har (Hibernate Archive)
    
    38: internal -> maven-archetype-sar (JBoss Service Archive)
    
    39: internal -> wicket-archetype-quickstart (A simple Apache Wicket project)
    
    40: internal -> quickstart (A simple Apache Tapestry 5 Project)
    
    41: internal -> scala-archetype-simple (A simple scala project)
    
    42: internal -> lift-archetype-blank (A blank/empty liftweb project)
    
    43: internal -> lift-archetype-basic (The basic (liftweb) project)
    
    44: internal -> cocoon-22-archetype-block-plain (
    
     
      http://cocoon.apache.org/2.2/ma
      
       
      
     
    
    
    ven-plugins/)
    
    45: internal -> cocoon-22-archetype-block (
    
     
      http://cocoon.apache.org/2.2/maven-pl
      
       
      
     
    
    
    ugins/)
    
    46: internal -> cocoon-22-archetype-webapp (
    
     
      http://cocoon.apache.org/2.2/maven-p
      
       
      
     
    
    
    lugins/)
    
    47: internal -> myfaces-archetype-helloworld (A simple archetype using MyFaces)
    
    48: internal -> myfaces-archetype-helloworld-facelets (A simple archetype using
    
    MyFaces and facelets)
    
    49: internal -> myfaces-archetype-trinidad (A simple archetype using Myfaces and
    
    Trinidad)
    
    50: internal -> myfaces-archetype-jsfcomponents (A simple archetype for create c
    
    ustom JSF components using MyFaces)
    
    51: internal -> gmaven-archetype-basic (Groovy basic archetype)
    
    52: internal -> gmaven-archetype-mojo (Groovy mojo archetype)
    
    53: internal -> struts2-archetype-starter (Struts 2 Starter Archetype)
    
    54: internal -> tynamo-archetype (Creates a CRUD web application based on Tapest
    
    ry 5 and Tynamo, a model-driven Java web framework)
    
    55: internal -> tellurium-junit-archetype (Tellurium JUnit project archetype for
    
    the Tellurium Automated Testing Framework)
    
    56: internal -> tellurium-testng-archetype (Tellurium TestNG project archetype f
    
    or the Tellurium Automated Testing Framework)
    
    57: internal -> scalate-archetype-empty (Generates a Scalate empty web applicati
    
    on)
    
    58: internal -> scalate-archetype-guice (Generates a Scalate Jog web application
    
    )
    
    Choose a number: 16: 2
    
    Define value for property ‘groupId’: : cn.bidlink
    
    Define value for property ‘artifactId’: : srpingMVN
    
    Define value for property ‘version’: 1.0-SNAPSHOT: :
    
    Define value for property ‘package’: cn.bidlink: : jar
    
    Confirm properties configuration:
    
    groupId: cn.bidlink
    
    artifactId: srpingMVN
    
    version: 1.0-SNAPSHOT
    
    package: jar
    
    Y: : Y
    
    通过指定’groupId’,’artifactId’,’version’,’package’完成项目的创建。
    
   
    
    
    
     Maven Eclipse Plugin
    
   
    Maven Eclipse Plugin 用来创建Eclipse的项目文件((*.classpath, *.wtpmodules and the .settings)。
    
    参考:
    
     
      http://maven.apache.org/plugins/maven-eclipse-plugin/index.html
      
       
      
     
    
   
    
    
    
     Goals:
    
   
    
     
      
      
     
    
    
     eclipse:configure-workspace
    
    
     
    
    is used to add the classpath variable M2_REPO to Eclipse which points to your local repository and optional to configure other workspace features.
    
    
     
      
      
     
    
    
     eclipse:eclipse
    
    
     
    
    generates the Eclipse configuration files.
    
    
     
      
      
     
    
    
     eclipse:clean
    
    
     
    
    is used to delete the files used by the Eclipse IDE.
    
    
     
      
      
     
    
    
     eclipse:myeclipse
    
    
     
    
    Generates the MyEclipse configuration files.
    
    
     
      
      
     
    
    
     eclipse:myeclipse-clean
    
    
     
    
    Deletes the config files used by MyEclipse.
    
    
     
      
      
     
    
    
     eclipse:help
    
    
     
    
    
    
    
     :
    
    Display help information on maven-eclipse-plugin.
   
    
    
    
     Usage:
    
   
    
    
    在Elcipse使用本地的maven资源库,通过如下命令将
    
     M2_REPO
    
    变量加入到eclipse
   
    mvn eclipse:configure-workspace \
    
    -Declipse.workspace=testworkspace \
    
    -Declipse.workspaceCodeStylesURL=
    
     
      http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/src/optional/eclipse-config/maven-styles.xml
      
       
      
     
    
    
    (或者mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo)
    
    在.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.core.prefs中会创建:
    
    #Fri Nov 12 13:45:10 CST 2010
    
    org.eclipse.jdt.core.classpathVariable.M2_REPO=C\:
    
    Documents and Settings\\Administrator\\.m2
    
    repository
    
    并且将workspaceCodeStylesURL指定的code styles format文件存放在org.eclipse.jdt.ui.prefs中。
   
    
    
    创建eclipse项目配置文件,如:.projectand .classpath files 等
   
    
     2.1 Load Coding Styles into Workspace
    
    
    mvn eclipse:eclipse -Declipse.projectDir=. \
    
    -Declipse.workspaceCodeStyleURL=
    
     
      http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/src/optional/eclipse-config/maven-styles.xml
      
       
      
     
    
    
    或者在pom.xml中配置
    
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-eclipse-plugin</artifactId>
    
    <version>2.8</version>
    
    <configuration>
    
    <workspace>${basedir}</workspace>
    
    <workspaceCodeStylesURL>
    
     
      http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/src/optional/eclipse-config/maven-styles.xml
      
       
      
     
    
    </workspaceCodeStylesURL>
    
    </configuration>
    
    </plugin>
    
    
     2.2 Configure Checkstyle
    
    
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-eclipse-plugin</artifactId>
    
    <version>2.8</version>
    
    <configuration>
    
    <additionalBuildcommands>
    
    <buildcommand>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</buildcommand>
    
    </additionalBuildcommands>
    
    <additionalProjectnatures>
    
    <projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
    
    </additionalProjectnatures>
    
    <additionalConfig>
    
    <file>
    
    <name>.checkstyle</name>
    
    <content>
    
    <![CDATA[<?xml version=”1.0″ encoding=”UTF-8″?>
    
    <fileset-config file-format-version=”1.2.0″ simple-config=”true”>
    
    <fileset name=”all” enabled=”true” check-config-name=”<YOUR CHECKSTYLE CONFIG NAME HERE>” local=”false”>
    
    <file-match-pattern match-pattern=”.” include-pattern=”true”/>
    
    </fileset>
    
    <filter name=”NonSrcDirs” enabled=”true”/>
    
    </fileset-config>
    
    ]]>
    
    </content>
    
    </file>
    
    </additionalConfig>
    
    </configuration>
    
    </plugin>
    
    
    
     2.3 Multpile Module Project
     
     2.3.1 垂直的工程结构
    
   
- 在eclipse中设置MO_REPO classpath变量
- 打开window命令窗口,进入workspace目录
- 通过命令创建一个maven父工程
mvn archetype:create -DgroupId=cn.bidlink -DartifactId=myproject
- 删除src目录,修改pom.xml文件中的packaing为pom:<packaging>pom</packaging>
- 在父工程下创建多个maven子工程
    cd myproject
    
    mvn archetype:create -DgroupId=cn.bidlink -DartifactId=myproject-site
    
    mvn archetype:create -DgroupId=cn.bidlink.core -DartifactId=myproject-core
    
    mvn archetype:create
    
    -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp
    
    -DgroupId=cn.bidlink -DartifactId=myproject-webapp
   
- 父工程自动将子工程添加在自己的pom.xml中:
    <modules>
    
    <module>myproject-site</module>
    
    <module>myproject-core</module>
    
    <module>myproject-webapp</module>
    
    </modules>
   
- 子工程的pom中自动继承父工程:
    <parent>
    
    <groupId>cn.bidlink</groupId>
    
    <artifactId>myproject</artifactId>
    
    <version>1.0-SNAPSHOT</version>
    
    </parent>
   
- 子工程之间的依赖,将core子工程添加到myproject-webapp中
    <dependency>
    
    <groupId>cn.bidlink.core</groupId>
    
    <artifactId>myproject-core</artifactId>
    
    <version>1.0-SNAPSHOT</version>
    
    </dependency>
   
- 创建eclipse项目工程
    mvn install
    
    mvn eclipse:eclipse
   
- 在eclispe通过import导入myproject,将会在eclipse创建myproject-webapp,module,site等三个工程,且module中自动会应用core工程。
    
    
     2.3.2扁平的工程结构
    
   
- 
     
 在myproject中创建一个新目录parent,将myproject下的pom.xml文件移到该目录下
 
- 
     
 修改pom.xml文件的子工程
 
    <modules>
    
    <module>../myproject-site</module>
    
    <module>../myproject-core</module> <module>../myproject-webapp</module>
    
    </modules>
   
- 
     
 修改子工程pom.xml中的parent引用
 
    <parent>
    
    <artifactId>myproject</artifactId>
    
    <groupId>cn.bidlink</groupId>
    
    <version>1.0-SNAPSHOT</version>
    
    <relativePath>../parent/pom.xml</relativePath>
    
    </parent>
    
    注意:扁平的工程结构有很多maven plguin 如:release插件不支持。
    
    
     2.4 Help
    
    
    通过运行mvn eclipse:help -Ddetail=true -Dgoal=<goal-name>可以获取goal的参数的详细信息。
    
   
    
    
    
     Maven Compiler Plugin
    
   
    Maven compiler plugin用来对maven工程源代码进行编译,默认是采用javac,source 和target均采用java1.5版本。
    
    参考:
    
     
      http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
      
       
      
     
    
   
    
    
    
     Goals:
    
   
    
     
      
      
     
    
    
     compiler:compile
    
    
     
    
    Compiles application sources
    
    
     
      
      
     
    
    
     compiler:help
    
    
     
    
    Display help information on maven-compiler-plugin. Call
    
    mvn compiler:help -Ddetail=true -Dgoal=<goal-name>
    
    to display parameter details.
   
    
    
    
     Usage:
    
   
    
    
    更改java版本和指定javac路径
   
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>
    
     maven
    
    
     compiler
    
    
     plugin
    
    </artifactId>
    
    <version>2.3.2</version>
    
    <configuration>
    
    <source>1.6</source>
    
    <target>1.6</target>
    
    <encoding>UTF-8</encoding>
    
    <verbose>true</verbose>
    
    <fork>true</fork>
    
    <executable>${JAVA_HOME}/bin/
    
     javac
    
    </executable>
    
    </configuration>
    
    </plugin>
    
   
    
    
    
     Maven xdoclet Plugin
    
   
    Xodoclet plugin用来创建hibernate的pojo对应的mapping文件
    
    参考:
    
     
      http://xdoclet.codehaus.org/Maven2+Plugin
      
       
      
     
    
    
    
     
      http://www.samaxes.com/2006/07/using-maven-2-xdoclet-2-and-hibernate-3/
      
       
      
     
    
    
    
     Goals:
    
    xdoclet
    
    
     Usage:
    
    
    配置如下:
    
    <plugin>
    
    <groupId>
    
     xdoclet
    
    </groupId>
    
    <artifactId>maven2-xdoclet2-
    
     plugin
    
    </artifactId>
    
    <version>2.0.5</version>
    
    <executions>
    
    <execution>
    
    <id>
    
     xdoclet
    
    </id>
    
    <phase>generate-sources</phase>
    
    <goals>
    
    <goal>
    
     xdoclet
    
    </goal>
    
    </goals>
    
    </execution>
    
    </executions>
    
    <dependencies>
    
    <dependency>
    
    <groupId>
    
     xdoclet
    
    –
    
     plugins
    
    </groupId>
    
    <artifactId>
    
     xdoclet
    
    
    
    
     plugin
    
    
     hibernate
    
    </artifactId>
    
    <version>1.0.2</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     nanocontainer
    
    </groupId>
    
    <artifactId>
    
     nanocontainer
    
    </artifactId>
    
    <version>1.0-beta-3</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     xdoclet
    
    </groupId>
    
    <artifactId>
    
     xdoclet
    
    </artifactId>
    
    <version>2.0.4</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     generama
    
    </groupId>
    
    <artifactId>
    
     generama
    
    </artifactId>
    
    <version>1.2.1</version>
    
    <exclusions>
    
    <exclusion>
    
    <artifactId>
    
     freemarker
    
    </artifactId>
    
    <groupId>
    
     freemarker
    
    </groupId>
    
    </exclusion>
    
    </exclusions>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     picocontainer
    
    </groupId>
    
    <artifactId>
    
     picocontainer
    
    </artifactId>
    
    <version>1.0</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     nanocontainer
    
    </groupId>
    
    <artifactId>
    
     nanocontainer
    
    -ant</artifactId>
    
    <version>1.0-beta-3</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     generama
    
    </groupId>
    
    <artifactId>
    
     qdox
    
    </artifactId>
    
    <version>20051211.114207</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>commons-jelly</groupId>
    
    <artifactId>commons-jelly</artifactId>
    
    <version>1.0</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>commons-jelly</groupId>
    
    <artifactId>commons-jelly-tags-define</artifactId>
    
    <version>1.0</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>commons-jelly</groupId>
    
    <artifactId>commons-jelly-tags-
    
     xml
    
    </artifactId>
    
    <version>20050823.222913</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>commons-
    
     jexl
    
    </groupId>
    
    <artifactId>commons-
    
     jexl
    
    </artifactId>
    
    <version>1.0</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>commons-jelly</groupId>
    
    <artifactId>commons-jelly-tags-
    
     jsl
    
    </artifactId>
    
    <version>1.0</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     saxpath
    
    </groupId>
    
    <artifactId>
    
     saxpath
    
    </artifactId>
    
    <version>1.0-FCS</version>
    
    </dependency>
    
    <dependency>
    
    <groupId>
    
     jaxen
    
    </groupId>
    
    <artifactId>
    
     jaxen
    
    </artifactId>
    
    <version>1.1-beta-4</version>
    
    </dependency>
    
    </dependencies>
    
    <configuration>
    
    <configs>
    
    <config>
    
    <components>
    
    <component>
    
    <classname>org.xdoclet.plugin.hibernate.HibernateMappingPlugin</classname>
    
    <params>
    
    <version>3.0</version>
    
    <force>true</force>
    
    <destdir>${project.build.outputDirectory}</destdir>
    
    </params>
    
    </component>
    
    </components>
    
    <includes>
    
     cn
    
    /
    
     bidlink
    
    /*
    
     /model/
    
    .java</includes>
    
    </config>
    
    </configs>
    
    </configuration>
    
    </plugin>
    
   
    
    
    
     Maven Source Plugin
    
   
    Maven source plugin 用来对代码源文件进行打包,打包后的source代码可以发布到资源库,在jar包被用到时可以一同被下载到本地,在eclipse工具中可以方便查看源代码。
    
    参考:
    
     
      http://maven.apache.org/plugins/maven-source-plugin/jar-mojo.html
      
       
      
     
    
   
    
    
    
     Goals:
    
   
    
     
      
      
     
    
    
     source:aggregate
    
    
     
    
    Aggregate sources for all modules in an aggregator project.
    
    
     
      
      
     
    
    
     source:jar
    
    
     
    
    This plugin bundles all the sources into a jar archive.
    
    
     
      
      
     
    
    
     source:help
    
    
     
    
    Display help information on maven-source-plugin. Call
    
    mvn source:help -Ddetail=true -Dgoal=<goal-name>
    
    to display parameter details.
   
    
    
    
     Usage:
    
   
    
    
    1.指定输出路径及文件名称
   
    <build>
    
    <plugins>
    
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-source-plugin</artifactId>
    
    <version>2.1.2</version>
    
    <configuration>
    
    <outputDirectory>/absolute/path/to/the/output/directory</outputDirectory>
    
    <finalName>filename-of-generated-jar-file</finalName>
    
    <attach>false</attach>
    
    </configuration>
    
    </plugin>
    
    </plugins>
    
    </build>
    
   
    
    
    
     Maven Javadoc Plugin
    
   
    Javadoc plugin通过使用javadoc工具给工程创建javadocs
    
    参考:
    
     
      http://maven.apache.org/plugins/maven-javadoc-plugin/
      
       
      
     
    
   
    
    
    
     Goals:
    
   
- 
     
 
 
 
 
 
 
 javadoc:javadoc
 
 
  
 
 generates the Javadoc files for the project. It executes the standard Javadoc tool and supports the parameters used by the tool.
- 
     
 
 
 
 
 
 
 javadoc:test-javadoc
 
 
  
 
 generates the test Javadoc files for the project. It executes the standard Javadoc tool and supports the parameters used by the tool.
- 
     
 
 
 
 
 
 
 javadoc:aggregate
 
 
  
 
 generates the Javadoc files for an aggregator project. It executes the standard Javadoc tool and supports the parameters used by the tool.
- 
     
 
 
 
 
 
 
 javadoc:test-aggregate
 
 
  
 
 generates the test Javadoc files for an aggregator project. It executes the standard Javadoc tool and supports the parameters used by the tool.
- 
     
 
 
 
 
 
 
 javadoc:jar
 
 
  
 
 creates an archive file of the generated Javadocs. It is used during the release process to create the Javadoc artifact for the project’s release. This artifact is uploaded to the remote repository along with the project’s compiled binary and source archive.
- 
     
 
 
 
 
 
 
 javadoc:test-jar
 
 
  
 
 creates an archive file of the generated Test Javadocs.
- 
     
 
 
 
 
 
 
 javadoc:aggregate-jar
 
 
  
 
 creates an archive file of the generated Javadocs for an aggregator project.
- 
     
 
 
 
 
 
 
 javadoc:test-aggregate-jar
 
 
  
 
 creates an archive file of the generated Test Javadocs for an aggregator project.
- 
     
 
 
 
 
 
 
 javadoc:fix
 
 
  
 
 is an interactive goal which fixes the Javadoc documentation and tags for the Java files.
- 
     
 
 
 
 
 
 
 javadoc:test-fix
 
 
  
 
 is an interactive goal which fixes the Javadoc documentation and tags for the test Java files.
    
    
    
     Usage:
    
   
    
    
    对多个项目工程创建javadoc
   
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-javadoc-plugin</artifactId>
    
    <version>2.7</version>
    
    <configuration>
    
    <!– Default configuration for all reports –>
    
    …
    
    </configuration>
    
    <executions>
    
    <execution>
    
    <id>aggregate</id>
    
    <goals>
    
    <goal>aggregate</goal>
    
    </goals>
    
    <phase>site</phase>
    
    <configuration>
    
    <!– Specific configuration for the aggregate report –>
    
    …
    
    </configuration>
    
    </execution>
    
    …
    
    </executions>
    
    </plugin>
    
    或者
    
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-javadoc-plugin</artifactId>
    
    <version>2.7</version>
    
    <configuration>
    
    <!– Default configuration for all reports –>
    
    …
    
    </configuration>
    
    <reportSets>
    
    <reportSet>
    
    <id>non-aggregate</id>
    
    <configuration>
    
    <!– Specific configuration for the non aggregate report –>
    
    …
    
    </configuration>
    
    <reports>
    
    <report>javadoc</report>
    
    </reports>
    
    </reportSet>
    
    <reportSet>
    
    <id>aggregate</id>
    
    <configuration>
    
    <!– Specific configuration for the aggregate report –>
    
    …
    
    </configuration>
    
    <reports>
    
    <report>aggregate</report>
    
    </reports>
    
    </reportSet>
    
    …
    
    </reportSets>
    
    </plugin>
    
    
    
   
    
    
    
     Maven SCM Plugin
    
   
SCM(Source Control Manager)plugin是maven提供的可以结合版本控制工具(CVS,SVN等)使用的插件。
    
    
    
     Goals:
    
   
- 
     
 
 
 
 
 
 
 scm:branch
 
 
  
 
 – branch the project
- 
     
 
 
 
 
 
 
 scm:validate
 
 
  
 
 – validate the scm information in the pom
- 
     
 
 
 
 
 
 
 scm:add
 
 
  
 
 – command to add file
- 
     
 
 
 
 
 
 
 scm:unedit
 
 
  
 
 – command to stop editing the working copy
- 
     
 
 
 
 
 
 
 scm:export
 
 
  
 
 – command to get a fresh exported copy
- 
     
 
 
 
 
 
 
 scm:bootstrap
 
 
  
 
 – command to checkout and build a project
- 
     
 
 
 
 
 
 
 scm:changelog
 
 
  
 
 – command to show the source code revisions
- 
     
 
 
 
 
 
 
 scm:list
 
 
  
 
 – command for get the list of project files
- 
     
 
 
 
 
 
 
 scm:checkin
 
 
  
 
 – command for commiting changes
- 
     
 
 
 
 
 
 
 scm:checkout
 
 
  
 
 – command for getting the source code
- 
     
 
 
 
 
 
 
 scm:status
 
 
  
 
 – command for showing the scm status of the working copy
- 
     
 
 
 
 
 
 
 scm:update
 
 
  
 
 – command for updating the working copy with the latest changes
- 
     
 
 
 
 
 
 
 scm:diff
 
 
  
 
 – command for showing the difference of the working copy with the remote one
- 
     
 
 
 
 
 
 
 scm:update-subprojects
 
 
  
 
 – command for updating all projects in a multi project build
- 
     
 
 
 
 
 
 
 scm:edit
 
 
  
 
 – command for starting edit on the working copy
- 
     
 
 
 
 
 
 
 scm:tag
 
 
  
 
 – command for tagging a certain revision
- 
     
 
 
 
 
 
 
 scm:help
 
 
  
 
 Display help information on maven-scm-plugin. Call
- mvn scm:help -Ddetail=true -Dgoal=<goal-name>
- to display parameter details.
    
    
    
     Usage:
    
   
    
    
    1.配置 SCM
   
    <scm>
    
    <developerConnection>scm:cvs:pserver:@192.168.0.249:/
    
     cvsroot
    
    /EOSS:base</developerConnection>
    
    </scm>
    
    配置scm链接后,可以在插件中引用
    
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-scm-plugin</artifactId>
    
    <version>1.4</version>
    
    <configuration>
    
    <connectionType>developerConnection</connectionType>
    
    <goals>install</goals>
    
    <username>liangbingyan</username>
    
    <password>654321</password>
    
    <providerImplementations>
    
    <cvs>cvs_native</cvs>
    
    </providerImplementations>
    
    </configuration>
    
    </plugin>
    
    配置好cvs,username,password等后可以通过执行scm的相关目标命令。如:
    
    mvn scm:bootstrap 从cvs下载代码并执行install操作
    
   
    
    
    scm的命令应用
   
    2.1显示cvs提交修改记录
    
    mvn -DstartDate=YYYY-MM-DD -DendDate=YYYY-MM-DD scm:changelog
    
    2.2显示不同修改版本之间的不同
    
    mvn -DstartRevision=<revision> -DendRevision=<revision> scm:diff
    
    2.3打tag标记
    
    mvn -Dtag=”<tag name>” scm:tag
    
    2.4验证scm配置的正确
    
    mvn -DscmConnection=”<scm url>” -DscmDeveloperConnection=”<scm url>” scm:validate
    
    2.5通过命令执行bootstrap,对部署项目很方便
    
    mvn -DconnectionUrl=scm:cvs:sspi:@9bb5e6546229466:2401:/repository:guide-ide-eclipse -Dmaven.scm.provider.cvs.implementation=cvs_native -Dpassword=1q2w3e -Dbasedir=. -DcheckoutDirectory=guide-ide-eclipse -Dgoals=install -DgoalsDirectory=parent scm:bootstrap
    
    
   
    
    
    
     Maven AntRun Plugin
    
   
Antrun plugin提供了执行ant中的task的功能,可以将ant的task放在pom中。
    
    
    
     Goals:
    
   
    
     
      
      
     
    
    
     antrun:help
    
    
     
    
    Display help information on maven-antrun-plugin. Call
    
    mvn antrun:help -Ddetail=true -Dgoal=<goal-name>
    
    to display parameter details.
    
    
     
      
      
     
    
    
     antrun:run
    
    
     
    
    Maven AntRun Mojo. This plugin provides the capability of calling Ant tasks from a POM by running the nested ant tasks inside the <tasks/> parameter. It is encouraged to move the actual tasks to a separate build.xml file and call that file with an <ant/> task.
   
    
    
    
     Usage:
    
   
    
    
    1.在pom中使用ant的task
   
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-antrun-plugin</artifactId>
    
    <version>1.6</version>
    
    <executions>
    
    <execution>
    
    <id>compile</id>
    
    <phase>compile</phase>
    
    <configuration>
    
    <target>
    
    <property name=”compile_classpath” refid=”maven.compile.classpath”/>
    
    <property name=”runtime_classpath” refid=”maven.runtime.classpath”/>
    
    <property name=”test_classpath” refid=”maven.test.classpath”/>
    
    <property name=”plugin_classpath” refid=”maven.plugin.classpath”/>
    
    <echo message=”compile classpath: ${compile_classpath}”/>
    
    <echo message=”runtime classpath: ${runtime_classpath}”/>
    
    <echo message=”test classpath: ${test_classpath}”/>
    
    <echo message=”plugin classpath: ${plugin_classpath}”/>
    
    </target>
    
    </configuration>
    
    <goals>
    
    <goal>run</goal>
    
    </goals>
    
    </execution>
    
    </executions>
    
    </plugin>推荐将ant的task单独放在一个build.xml文件中,通过如下方式使用:
    
    <plugin>
    
    <groupId>org.apache.maven.plugins</groupId>
    
    <artifactId>maven-antrun-plugin</artifactId>
    
    <version>1.6</version>
    
    <executions>
    
    <execution>
    
    <id>compile</id>
    
    <phase>compile</phase>
    
    <configuration>
    
    <target>
    
    <property name=”compile_classpath” refid=”maven.compile.classpath”/>
    
    <property name=”runtime_classpath” refid=”maven.runtime.classpath”/>
    
    <property name=”test_classpath” refid=”maven.test.classpath”/>
    
    <property name=”plugin_classpath” refid=”maven.plugin.classpath”/>
    
    <ant antfile=”${basedir}/build.xml”>
    
    <target name=”test”/>
    
    </ant>
    
    </target>
    
    </configuration>
    
    <goals>
    
    <goal>run</goal>
    
    </goals>
    
    </execution>
    
    </executions>
    
    </plugin>
    
    其中build.xml定义如下:
    
    <?xml version=”1.0″?>
    
    <project name=”test6″>
    
    <target name=”test”>
    
    <echo message=”compile classpath: ${compile_classpath}”/>
    
    <echo message=”runtime classpath: ${runtime_classpath}”/>
    
    <echo message=”test classpath: ${test_classpath}”/>
    
    <echo message=”plugin classpath: ${plugin_classpath}”/>
    
    </target>
    
    </project>
   
    
    
    使用自定义的task
   
    <configuration>
    
    <property name=
    
     “log4j.log4j.jar.path”
    
    value=
    
     “${log4j:log4j:jar}”
    
    />
    
    <taskdef resource=
    
     “net/sf/antcontrib/antcontrib.properties”
    
    >
    
    </taskdef>
    
    <taskdef name=
    
     “for”
    
    classname=
    
     “net.sf.antcontrib.logic.For”
    
    >
    
    </taskdef>
    
    <for list=
    
     “${log4jproperties}”
    
    delimiter=
    
     “,”
    
    param=
    
     “propertykey”
    
    >
    
    <sequential>
    
    <propertycopy property=
    
     “propertyvalue”
    
    from=
    
     “@{propertykey}”
    
    override=
    
     “true”
    
    />
    
    <propertyfile file=
    
     “src/main/resources/log4j.properties”
    
    >
    
    <entry key=
    
     “@{propertykey}”
    
    value=
    
     “${propertyvalue}”
    
    />
    
    </propertyfile>
    
    <echo>@{
    
    
     propertykey
    
    }=${
    
    
     propertyvalue
    
    }</echo>
    
    </sequential>
    
    </for>
    
    </configuration>
    
   
    
    
    
     Maven Dependency Plugin
    
   
Dependency Plugin提供了对项目依赖的artifacts的操作管理。
    
    
    
     Goals:
    
   
- 
     
 
 
 
 
 
 
 dependency:copy
 
 
  
 
 takes a list of artifacts defined in the plugin configuration section and copies them to a specified location, renaming them or stripping the version if desired. This goal can resolve the artifacts from remote repositories if they don’t exist in local.
- 
     
 
 
 
 
 
 
 dependency:copy-dependencies
 
 
  
 
 takes the list of project direct dependencies and optionally transitive dependencies and copies them to a specified location, stripping the version if desired. This goal can also be run from the command line.
- 
     
 
 
 
 
 
 
 dependency:unpack
 
 
  
 
 like copy but unpacks.
- 
     
 
 
 
 
 
 
 dependency:unpack-dependencies
 
 
  
 
 like copy-dependencies but unpacks.
- 
     
 
 
 
 
 
 
 dependency:resolve
 
 
  
 
 tells Maven to resolve all dependencies and displays the version.
- 
     
 
 
 
 
 
 
 dependency:list
 
 
  
 
 is an alias for dependency:resolve
- 
     
 
 
 
 
 
 
 dependency:sources
 
 
  
 
 tells Maven to resolve all dependencies and their source attachments, and displays the version.
- 
     
 
 
 
 
 
 
 dependency:resolve-plugins
 
 
  
 
 Tells Maven to resolve plugins and their dependencies.
- 
     
 
 
 
 
 
 
 dependency:list
 
 
  
 
 alias for resolve that lists the dependencies for this project.
- 
     
 
 
 
 
 
 
 dependency:go-offline
 
 
  
 
 tells Maven to resolve everything this project is dependent on (dependencies, plugins, reports) in preparation for going offline.
- 
     
 
 
 
 
 
 
 dependency:purge-local-repository
 
 
  
 
 tells Maven to clear all dependency-artifact files out of the local repository, and optionally re-resolve them.
- 
     
 
 
 
 
 
 
 dependency:build-classpath
 
 
  
 
 tells Maven to output the path of the dependencies from the local repository in a classpath format to be used in java -cp. The classpath file may also be attached and installed/deployed along with the main artifact.
- 
     
 
 
 
 
 
 
 dependency:analyze
 
 
  
 
 analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared.
- 
     
 
 
 
 
 
 
 dependency:analyze-only
 
 
  
 
 is the same as analyze, but is meant to be bound in a pom. It does not fork the build and execute test-compile.
- 
     
 
 
 
 
 
 
 dependency:analyze-dep-mgt
 
 
  
 
 analyzes your projects dependencies and lists mismatches between resolved dependencies and those listed in your dependencyManagement section.
- 
     
 
 
 
 
 
 
 dependency:tree
 
 
  
 
 displays the dependency tree for this project.
    
   
    
    
    
     Usage:
    
   
    
    
    使用依赖关系的tree结构解决依赖冲突
   
    mvn dependency:tree -Dverbose -Dincludes=commons-collections
    
    将看到
    
    [INFO] [dependency:tree]
    
    [INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
    
    [INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
    
    [INFO] | – commons-validator:commons-validator:jar:1.2.0:compile
    
    [INFO] | – commons-digester:commons-digester:jar:1.6:compile
    
    [INFO] | – (commons-collections:commons-collections:jar:2.1:compile – omitted for conflict with 2.0)
    
    [INFO] – org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
    
    [INFO] – org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
    
    [INFO] – commons-collections:commons-collections:jar:2.0:compile
    
    可以很清楚看到相关冲突信息
    
   
    
    
    
     Maven Assembly Plugin
    
   
Assembly 插件提供了手动对某些文件和依赖打成各种包格式的功能。
    
    
    
     Goals:
    
   
    
     
      
      
     
    
    
     assembly:help
    
    
     
    
    Display help information on maven-assembly-plugin. Call
    
    mvn assembly:help -Ddetail=true -Dgoal=<goal-name>
    
    
     
      
      
     
    
    
     assembly:single
    
    
     
    
    Assemble an application bundle or distribution from an assembly descriptor. This goal is suitable either for binding to the lifecycle or calling directly from the command line (provided all required files are available before the build starts, or are produced by another goal specified before this one on the command line).
   
    
    
    
     Usage:
    
   
    
    
    
     打web service客户端包
    
   
- 创建assembly配置文件,如:src/main/assembly/space-ws-jar.xml
    
     <
    
    
     assembly
    
    
     xmlns
    
    =
    
     
      “http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2”
     
    
    
    
     xmlns:xsi
    
    =
    
     
      “http://www.w3.org/2001/XMLSchema-instance”
     
    
    
    
     xsi:schemaLocation
    
    =
    
     
      “http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
      
       
        http://maven.apache.org/xsd/assembly-1.1.2.xsd
        
         
        
       
      
      ”
     
    
    
     >
    
    
    
     <
    
    
     id
    
    
     >
    
    space-
    
     ws
    
    -jar
    
     </
    
    
     id
    
    
     >
    
    
    
     <
    
    
     includeBaseDirectory
    
    
     >
    
    false
    
     </
    
    
     includeBaseDirectory
    
    
     >
    
    
    
     <
    
    
     formats
    
    
     >
    
    
    
     <
    
    
     format
    
    
     >
    
    jar
    
     </
    
    
     format
    
    
     >
    
    
    
     </
    
    
     formats
    
    
     >
    
    
    
     <
    
    
     fileSets
    
    
     >
    
    
    
     <
    
    
     fileSet
    
    
     >
    
    
    
     <
    
    
     outputDirectory
    
    
     >
    
    /
    
     </
    
    
     outputDirectory
    
    
     >
    
    
    
     <
    
    
     directory
    
    
     >
    
    
    ${project.build.outputDirectory}
    
    
     </
    
    
     directory
    
    
     >
    
    
    
     <
    
    
     includes
    
    
     >
    
    
    
     <
    
    
     include
    
    
     >
    
    
     cn
    
    /
    
     bidlink
    
    /space/
    
     webservice
    
    /*.class
    
     </
    
    
     include
    
    
     >
    
    
    
     <
    
    
     include
    
    
     >
    
    
     cn
    
    /
    
     bidlink
    
    /space/follower/
    
     dto
    
    /*.class
    
     </
    
    
     include
    
    
     >
    
    
    
     <
    
    
     include
    
    
     >
    
    
     cn
    
    /
    
     bidlink
    
    /space/
    
     myspace
    
    /
    
     dto
    
    /*.class
    
     </
    
    
     include
    
    
     >
    
    
    
     <
    
    
     include
    
    
     >
    
    
     cn
    
    /
    
     bidlink
    
    /space/notice/
    
     dto
    
    /*.class
    
     </
    
    
     include
    
    
     >
    
    
    
     </
    
    
     includes
    
    
     >
    
    
    
     </
    
    
     fileSet
    
    
     >
    
    
    
     </
    
    
     fileSets
    
    
     >
    
    
    
     </
    
    
     assembly
    
    
     >
    
   
- 配置Assembly 插件
    
     <
    
    
     plugin
    
    
     >
    
    
    
     <
    
    
     groupId
    
    
     >
    
    org.apache.maven.plugins
    
     </
    
    
     groupId
    
    
     >
    
    
    
     <
    
    
     artifactId
    
    
     >
    
    maven-assembly-plugin
    
     </
    
    
     artifactId
    
    
     >
    
    
    
     <
    
    
     version
    
    
     >
    
    2.2.1
    
     </
    
    
     version
    
    
     >
    
    
    
     <
    
    
     configuration
    
    
     >
    
    
    
     <
    
    
     descriptors
    
    
     >
    
    
    
     <
    
    
     descriptor
    
    
     >
    
    src/main/assembly/space-ws-jar.xml
    
     </
    
    
     descriptor
    
    
     >
    
    
    
     </
    
    
     descriptors
    
    
     >
    
    
    
     <
    
    
     appendAssemblyId
    
    
     >
    
    false
    
     </
    
    
     appendAssemblyId
    
    
     >
    
    
    
     <
    
    
     finalName
    
    
     >
    
    ${space.ws.name}
    
     </
    
    
     finalName
    
    
     >
    
    
    
     </
    
    
     configuration
    
    
     >
    
    
    
     <
    
    
     executions
    
    
     >
    
    
    
     <
    
    
     execution
    
    
     >
    
    
    
     <
    
    
     id
    
    
     >
    
    make-space-ws-jar
    
     </
    
    
     id
    
    
     >
    
    
    
     <
    
    
     goals
    
    
     >
    
    
    
     <
    
    
     goal
    
    
     >
    
    single
    
     </
    
    
     goal
    
    
     >
    
    
    
     </
    
    
     goals
    
    
     >
    
    
    
     </
    
    
     execution
    
    
     >
    
    
    
     </
    
    
     executions
    
    
     >
    
    
    
     </
    
    
     plugin
    
    
     >
    
    
    3)运行命令:mvn assembly:single就可以将制定文件达成jar包了。
    
   
    
    
    
     mvn命令使用说明
    
   
    usage: mvn [options] [<goal(s)>] [<phase(s)>]
    
    Options:
    
    
     am,
    
    -also-make If project list is specified, also
    
    build projects required by the
    
    list
    
    
     amd,
    
    -also-make-dependents If project list is specified, also
    
    build projects that depend on
    
    projects on the list
    
    
     B,
    
    -batch-mode Run in non-interactive (batch)
    
    mode
    
    
     C,
    
    -strict-checksums Fail the build if checksums don’t
    
    match
    
    
     c,
    
    -lax-checksums Warn if checksums don’t match
    
    
     cpu,
    
    -check-plugin-updates Ineffective, only kept for
    
    backward compatibility
    
    
     D,
    
    -define <arg> Define a system property
    
    
     e,
    
    -errors Produce execution error messages
    
    
     emp,
    
    -encrypt-master-password <arg> Encrypt master security password
    
    
     ep,
    
    -encrypt-password <arg> Encrypt server password
    
    
     f,
    
    -file Force the use of an alternate POM
    
    file.
    
    
     fae,
    
    -fail-at-end Only fail the build afterwards;
    
    allow all non-impacted builds to
    
    continue
    
    
     ff,
    
    -fail-fast Stop at first failure in
    
    reactorized builds
    
    
     fn,
    
    -fail-never NEVER fail the build, regardless
    
    of project result
    
    
     gs,
    
    -global-settings <arg> Alternate path for the global
    
    settings file
    
    
     h,
    
    -help Display help information
    
    
     l,
    
    -log-file <arg> Log file to where all build output
    
    will go.
    
    
     N,
    
    -non-recursive Do not recurse into sub-projects
    
    
     npr,
    
    -no-plugin-registry Ineffective, only kept for
    
    backward compatibility
    
    
     npu,
    
    -no-plugin-updates Ineffective, only kept for
    
    backward compatibility
    
    
     nsu,
    
    -no-snapshot-updates Supress SNAPSHOT updates
    
    
     o,
    
    -offline Work offline
    
    
     P,
    
    -activate-profiles <arg> Comma-delimited list of profiles
    
    to activate
    
    
     pl,
    
    -projects <arg> Build specified reactor projects
    
    instead of all projects. A project
    
    can be specified by
    
    [groupId]:artifactId or by its
    
    relative path.
    
    
     q,
    
    -quiet Quiet output – only show errors
    
    
     rf,
    
    -resume-from <arg> Resume reactor from specified
    
    project
    
    
     s,
    
    -settings <arg> Alternate path for the user
    
    settings file
    
    
     T,
    
    -threads <arg> Thread count, for instance 2.0C
    
    where C is core multiplied
    
    
     t,
    
    -toolchains <arg> Alternate path for the user
    
    toolchains file
    
    
     U,
    
    -update-snapshots Forces a check for updated
    
    releases and snapshots on remote
    
    repositories
    
    
     up,
    
    -update-plugins Ineffective, only kept for
    
    backward compatibility
    
    
     V,
    
    -show-version Display version information
    
    WITHOUT stopping build
    
    
     v,
    
    -version Display version information
    
    
     X,
    
    -debug Produce execution debug output
    
   
    
    
    例1:
   
    分析eoss-base的dependency,打开debug信息,并且输出到log.txt文件中
    
    E:\workspaces\eossmvn\eoss-core>mvn dependency:tree -Dverbose -Dincludes=eoss-ba
    
    se -X -l log.txt
   
    
    
    例2:
   
    使用线下编译方式,不从远程资源库下载包
    
    mvn -o compile
    
    
   
 
