maven related knowledge

maven related knowledge

1.
mvn assembly:assembly

mvn package -Dmaven.test.skip=true
-Dtest=SplashTest
mvn test -Dtest=Test***
#mvn help:effective-pom
mvn dependency:tree
http://www.cnblogs.com/bigtall/archive/2011/03/23/1993253.html

2.
<? xml version="1.0" encoding="UTF-8" ?>
< project  xmlns ="http://maven.apache.org/POM/4.0.0"  xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation ="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
  
< modelVersion > 4.0.0 </ modelVersion >
  
< groupId > com.xxx </ groupId >
  
< artifactId > pmm </ artifactId >
  
< version > 6.1.0-SNAPSHOT </ version >
  
< packaging > pom </ packaging >

  
< parent >
    
< groupId > com.xxx.maven </ groupId >
    
< artifactId > parent-product </ artifactId >
    
< version > 6.1.0-SNAPSHOT </ version >
    
< relativePath  />
  
</ parent >

  
< modules >
    
< module > xxx</ module >
  
</ modules >

</ project >

< project  xmlns ="http://maven.apache.org/POM/4.0.0"  xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation
="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
  
< modelVersion > 4.0.0 </ modelVersion >
  
< groupId > com.xxx.xxx </ groupId >
  
< artifactId >xxx </ artifactId >
  
< packaging > jar </ packaging >
  
< parent >
    
< groupId > com.xxx.xxx.maven </ groupId >
    
< artifactId > parent-jar </ artifactId >
    
< version > 6.1.0-SNAPSHOT </ version >
    
< relativePath  />
  
</ parent >

  
< dependencyManagement >
    
< dependencies >
      
< dependency >
        
< groupId > com.xxx </ groupId >
        
< artifactId >xxx </ artifactId >
        
< version > ${project.version} </ version >
        
< scope > import </ scope >
        
< type > pom </ type >
      
</ dependency >
    
</ dependencies >
  
</ dependencyManagement >

  
< properties >
    
< src .dir > src/main/java </ src.dir >
    
< mvn .classpath > maven.compile.classpath </ mvn.classpath >
  
</ properties >

  
< dependencies >
    
< dependency >
      
< groupId > org.jboss.logging </ groupId >
      
< artifactId > jboss-logging </ artifactId >
      
< scope > test </ scope >
    
</ dependency >
  
</ dependencies >

  
< build >
    
< plugins >
      
< plugin >
        
< groupId > org.apache.maven.plugins </ groupId >
        
< artifactId > maven-assembly-plugin </ artifactId >
        
< executions >
          
< execution >
            
< id > chargingplugin-api </ id >
            
< phase > package </ phase >
            
< goals >
              
< goal > single </ goal >
            
</ goals >
            
< configuration >
              
< descriptors >
                
< descriptor > src/main/assembly/chargingplugin-api.xml </ descriptor >
              
</ descriptors >
            
</ configuration >
          
</ execution >
        
</ executions >
      
</ plugin >

      
< plugin >
        
< artifactId > maven-antrun-plugin </ artifactId >
        
< version > 1.7 </ version >
        
< executions >

          
< execution >
            
< phase > package </ phase >
            
< id > activation-api </ id >
            
< configuration >
              
< target  name ="-javadoc" >
                
< javadoc  destdir ="target/activation-api"  author ="false"
                  verbose
="false"  access ="public"
                  packagenames
="com.drutt.pmm.activation.api.*"  version ="true"
                  use
="true"  windowtitle ="Ericsson Drutt MSDP Activation API" >
                  
< fileset  dir ="${src.dir}"  id ="activationapi.javadoc" >
                    
< include
                      
name ="com/drutt/pmm/activation/api/ActivationData.java"   />
                    
< include
                      
name ="com/drutt/pmm/activation/api/ExternalActivationPolicy.java"   />
                  
</ fileset >
                  
< classpath  refid ="${mvn.classpath}"   />
                  
< doctitle >
        
<![CDATA[ <h1>Ericsson Drutt MSDP Activation API</h1> ]]> </ doctitle >
                  
< bottom >
          
<![CDATA[ <i>Copyright © 2009 Ericsson Corp. All Rights Reserved.</i> ]]>
                  
</ bottom >
                  
< link  href ="http://java.sun.com/j2se/1.5.0/docs/api"   />
                
</ javadoc >
                
< zip  basedir ="target/activation-api"  destfile ="target/pmm-activationapi-javadoc.zip"
                  compress
="true"   />
                
< attachartifact  file ="target/pmm-activationapi-javadoc.zip"
                  type
="zip"  classifier ="activationapi-javadoc"   />
              
</ target >
            
</ configuration >
            
< goals >
              
< goal > run </ goal >
            
</ goals >
          
</ execution >

          
< execution >
            
< phase > package </ phase >
            
< id > chargingplugin-api </ id >
            
< configuration >
              
< target  name ="-javadoc" >
                
< javadoc  destdir ="target/chargingplugin-api"
                  author
="false"  verbose ="false"  access ="public"
                  packagenames
="com.drutt.pmm.commerce.publicapi.chargingintegration.*"
                  version
="true"  use ="true"
                  windowtitle
="Ericsson Drutt MSDP Chagingplugin API" >
                  
< fileset  dir ="${src.dir}"  id ="chargingpluginapi.javadoc" >
                    
< exclude
                      
name ="com/drutt/pmm/commerce/api/DeviceApiData.java"   />
                    
< include
                      
name ="com/drutt/pmm/commerce/publicapi/chargingintegration/v1_0/*.java"   />
                    
< include
                      
name ="com/drutt/pmm/commerce/api/ChargingInfoData.java"   />
                    
< include
                      
name ="com/drutt/pmm/commerce/api/AssetApiData.java"   />
                    
< include  name ="com/drutt/pmm/commerce/api/*ApiData.java"   />
                    
< include  name ="com/drutt/pmm/commerce/api/*Type.java"   />
                    
< include  name ="com/drutt/pmm/commerce/api/*State.java"   />
                  
</ fileset >
                  
< classpath  refid ="${mvn.classpath}"   />
                  
< doctitle >
      
<![CDATA[ <h1>Ericsson MSDP ChargingIntegration API</h1> ]]> </ doctitle >
                  
< bottom >
      
<![CDATA[ <i>Copyright © 2012 Ericsson Corp. All Rights Reserved.</i> ]]>
                  
</ bottom >
                  
< link  href ="http://java.sun.com/j2se/1.6.0/docs/api"   />
                
</ javadoc >
                
< zip  basedir ="target/chargingplugin-api"  destfile ="target/chargingplugin-api-javadoc.zip"
                  compress
="true"   />
                
< attachartifact  file ="target/chargingplugin-api-javadoc.zip"
                  type
="zip"  classifier ="chargingplugin-api-javadoc"   />
              
</ target >
            
</ configuration >
            
< goals >
              
< goal > run </ goal >
            
</ goals >
          
</ execution >
       
</ executions >
      
</ plugin >

      
< plugin >
        
< groupId > org.apache.maven.plugins </ groupId >
        
< artifactId > maven-dependency-plugin </ artifactId >
        
< executions >
          
< execution >
            
< phase > validate </ phase >
            
< goals >
              
< goal > copy-dependencies </ goal >
            
</ goals >
            
< configuration >
              
< stripVersion > true </ stripVersion >
              
< outputDirectory > ${project.build.directory}/dep-lib </ outputDirectory >
            
</ configuration >
          
</ execution >
        
</ executions >
      
</ plugin >
      
      
< plugin >
        
< groupId > org.apache.maven.plugins </ groupId >
        
< artifactId > maven-surefire-plugin </ artifactId >
        
< configuration >
          
< forkMode > always </ forkMode >
        
</ configuration >
      
</ plugin >
    
</ plugins >
  
</ build >
</ project >

   
----------------------------------------------------------------------------------------
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
  <id>chargingplugin-api-v2</id>
    <formats>  
        <format>jar</format>  
    </formats>  
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>  
        <fileSet>  
            <directory>${project.build.outputDirectory}/</directory>
            <includes>
              <include>com/drutt/pmm/commerce/publicapi/chargingintegration/v2_0/*.class</include>
              <include>com/drutt/pmm/commerce/publicapi/chargingintegration/v2_0/data/*.class</include>
            </includes>
            <outputDirectory>/</outputDirectory>
        </fileSet>  
    </fileSets>  
</assembly>



3.

< project  xmlns ="http://maven.apache.org/POM/4.0.0"  xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation ="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
    
< modelVersion > 4.0.0 </ modelVersion >
    
< groupId > com.xxx.contentx </ groupId >
    
< artifactId > xxx </ artifactId >
    
< packaging > war </ packaging >

    
< parent >
        
< groupId > com.xxx </ groupId >
        
< artifactId >xxxx </ artifactId >
        
< version > 6.1.0-SNAPSHOT </ version >
    
</ parent >

    
< dependencyManagement >
      
< dependencies >
        
< dependency >
          
< groupId > com.xxx </ groupId >
          
< artifactId >xxx </ artifactId >
          
< version > ${project.version} </ version >
          
< scope > import </ scope >
          
< type > pom </ type >
        
</ dependency >
      
</ dependencies >
    
</ dependencyManagement >

    
< properties >
      
< mvn .class.webapp > webapp-classes </ mvn.class.webapp >
      
< mvn .src.webapp > src/main/webapp </ mvn.src.webapp >
      
< mvn .src.webapp.tld > ${mvn.src.webapp}/WEB-INF/tld </ mvn.src.webapp.tld >
    
</ properties >

    
< dependencies >
      < dependency >
        
< groupId > org.apache.tomcat </ groupId >
        
< artifactId > jasper </ artifactId >
        
< scope > provided </ scope >
      
</ dependency >
    
      
<!--  following dependency is test scope  -->
      
< dependency >
        
< groupId > httpunit </ groupId >
        
< artifactId > httpunit </ artifactId >
        
< scope > test </ scope >
      
</ dependency >
    
</ dependencies >

    
< build >
      
< plugins >
        
< plugin >
          
< groupId > org.apache.maven.plugins </ groupId >
          
< artifactId > maven-dependency-plugin </ artifactId >
          
< executions >
            
< execution >
              
< id > copy-recommendation-tld </ id >
              
< phase > process-sources </ phase >
              
< goals >
                
< goal > unpack-dependencies </ goal >
              
</ goals >
              
< configuration >
                
< includeGroupIds > com.xxx.recommendation </ includeGroupIds >
                
< includeArtifactIds >xxx -engine </ includeArtifactIds >
                
< classifier > tag-lib </ classifier >
                
< type > zip </ type >
                
< outputDirectory >
                  ${mvn.src.webapp}
                
</ outputDirectory >
              
</ configuration >
            
</ execution >
  
            
< execution >
              
< id > unpack-xxx-tld </ id >
              
< phase > validate </ phase >
              
< goals >
                
< goal > unpack-dependencies </ goal >
              
</ goals >
              
< configuration >
                
< includeGroupIds > com.xxx.xxx </ includeGroupIds >
                
< includeArtifactIds >xxx </ includeArtifactIds >
                
< type > jar </ type >
                
< includes > **/premium.tld,**/util.tld,**/xxx.tld </ includes >
                
< outputDirectory >
                  ${project.build.directory}/tld
                
</ outputDirectory >
              
</ configuration >
            
</ execution >
  
            
< execution >
              
< id > unpack-mashup-tld </ id >
              
< phase > validate </ phase >
              
< goals >
                
< goal > unpack-dependencies </ goal >
              
</ goals >
              
< configuration >
                
< includeGroupIds > dpc </ includeGroupIds >
                
< includeArtifactIds >xxxxx </ includeArtifactIds >
                
< type > zip </ type >
                
< includes > **/rating.tld,**/richmedia*.tld,**/commerce*.tld,**/mci.tld,**/indexe*.tld </ includes >
                
< outputDirectory >
                  ${mvn.src.webapp.tld}
                
</ outputDirectory >
              
</ configuration >
            
</ execution >
  
            
< execution >
              
< phase > validate </ phase >
              
< goals >
                
< goal > copy-dependencies </ goal >
              
</ goals >
              
< configuration >
                
< stripVersion > true </ stripVersion >
                
< outputDirectory > ${project.build.directory}/dep-lib </ outputDirectory >
              
</ configuration >
            
</ execution >
          
</ executions >
        
</ plugin >
  
        
< plugin >
          
< groupId > org.apache.maven.plugins </ groupId >
          
< artifactId > maven-resources-plugin </ artifactId >
          
< executions >
            
< execution >
              
< id > copy-xxxx-tld </ id >
              
< phase > process-sources </ phase >
              
< goals >
                
< goal > copy-resources </ goal >
              
</ goals >
              
< configuration >
                
< outputDirectory > ${mvn.src.webapp.tld} </ outputDirectory >
                
< resources >
                  
< resource >
                    
< directory > ${project.build.directory}/tld/com/xxx/xxx/runtime/tag/pmm/ </ directory >
                    
< includes >
                      
< include > pmm.tld </ include >
                    
</ includes >
                  
</ resource >
                  
< resource >
                    
< directory > ${project.build.directory}/tld/com/xxx/xxx/runtime/tag/premium/ </ directory >
                    
< includes >
                      
< include > premium.tld </ include >
                    
</ includes >
                  
</ resource >
                  
< resource >
                    
< directory > ${project.build.directory}/tld/com/xxx/xxx/runtime/tag/util/ </ directory >
                    
< includes >
                      
< include > util.tld </ include >
                    
</ includes >
                  
</ resource >
                
</ resources >
              
</ configuration >
            
</ execution >
          
</ executions >
        
</ plugin >
  
        
< plugin >
          
< groupId > org.apache.maven.plugins </ groupId >
          
< artifactId > maven-war-plugin </ artifactId >
          
< configuration >
            
< webappDirectory > ${project.build.directory}/${mvn.class.webapp} </ webappDirectory >
            
< archiveClasses > true </ archiveClasses >
            
< archive >
              
< addMavenDescriptor > false </ addMavenDescriptor >
            
</ archive >
          
</ configuration >
        
</ plugin >
  
        
< plugin >
          
< groupId > org.codehaus.mojo </ groupId >
          
< artifactId > build-helper-maven-plugin </ artifactId >
          
< executions >
            
< execution >
              
< id > attach-artifacts </ id >
              
< phase > package </ phase >
              
< goals >
                
< goal > attach-artifact </ goal >
              
</ goals >
              
< configuration >
                
< artifacts >
                  
< artifact >
                    
< file > ${project.build.directory}/${mvn.class.webapp}/WEB-INF/lib/${artifactId}.jar </ file >
                  
</ artifact >
                
</ artifacts >
              
</ configuration >
            
</ execution >
          
</ executions >
        
</ plugin >
  
        
< plugin >
          
< groupId > org.apache.maven.plugins </ groupId >
          
< artifactId > maven-surefire-plugin </ artifactId >
          
< configuration >
            
< forkMode > always </ forkMode >
            
< includes >
              
< include > **/taglib/**/**/*Test.java </ include >
            
</ includes >
          
</ configuration >
        
</ plugin >
      
</ plugins >
    
</ build >
</ project >

你可能感兴趣的:(maven related knowledge)