Maven pom.xml 配置详解

什么是pom?
    pom作为项目对象模型。通过xml表示maven项目,使用pom.xml来实现。主要描述了项目:包括配置文件;开发者需要遵循的规则,缺陷管理系统,组织和licenses,项目的url,项目的依赖性,以及其他所有的项目相关因素。

 

pom.xml 配置文件

 

[html]  view plain copy print ?
 
  1. <project>  
  2.     <parent>  
  3.         ...  
  4.     parent>  
  5.       
  6.     <modelVersion>4.0.0modelVersion>  
  7.   
  8.       
  9.     <groupId>...groupId>  
  10.     <artifactId>...artifactId>  
  11.     <version>...version>  
  12.     <packaging>...packaging>  
  13.       
  14.     <scm>  
  15.         ...  
  16.     scm>  
  17.       
  18.     <dependencies>  
  19.         ...  
  20.     dependencies>  
  21.       
  22.     <dependencyManagement>  
  23.         ...  
  24.     dependencyManagement>  
  25.       
  26.     <modules>  
  27.         ...  
  28.     modules>  
  29.       
  30.     <properties>  
  31.         ...  
  32.     properties>  
  33.   
  34.       
  35.     <build>  
  36.         ...  
  37.     build>  
  38.     <reporting>  
  39.         ...  
  40.     reporting>  
  41.   
  42.       
  43.     <name>...name>  
  44.     <description>...description>  
  45.     <url>...url>  
  46.     <inceptionYear>...inceptionYear>  
  47.       
  48.     <licenses>  
  49.     licenses>  
  50.       
  51.     <organization>  
  52.     organization>  
  53.       
  54.     <developers>  
  55.     developers>  
  56.       
  57.     <contributors>  
  58.     contributors>  
  59.   
  60.       
  61.     <issueManagement>  
  62.     issueManagement>  
  63.       
  64.     <ciManagement>  
  65.     ciManagement>  
  66.       
  67.     <mailingLists>  
  68.     mailingLists>  
  69.       
  70.     <prerequisites>  
  71.     prerequisites>  
  72.       
  73.     <repositories>  
  74.     repositories>  
  75.       
  76.     <pluginRepositories>  
  77.     pluginRepositories>  
  78.       
  79.     <distributionManagement>  
  80.     distributionManagement>  
  81.       
  82.     <profiles>  
  83.     profiles>  
  84. project>  

 

maven POM.xml详解

[html]  view plain copy print ?
 
  1. <project xmlns="http://maven.apache.org/POM/4.0.0"     
  2.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd">     
  4.         
  5.     <parent>    
  6.          
  7.      <artifactId/>    
  8.          
  9.      <groupId/>    
  10.          
  11.      <version/>    
  12.          
  13.      <relativePath/>    
  14.  parent>    
  15.         
  16.     <modelVersion>4.0.0modelVersion>     
  17.          
  18.     <groupId>asia.banseongroupId>     
  19.          
  20.     <artifactId>banseon-maven2artifactId>     
  21.          
  22.     <packaging>jarpackaging>     
  23.          
  24.     <version>1.0-SNAPSHOTversion>     
  25.          
  26.     <name>banseon-mavenname>     
  27.          
  28.     <url>http://www.baidu.com/banseonurl>     
  29.          
  30.     <description>A maven project to study maven.description>     
  31.         
  32.  <prerequisites>    
  33.       
  34.     <maven/>    
  35.  prerequisites>    
  36.       
  37.     <issueManagement>    
  38.           
  39.         <system>jirasystem>     
  40.             
  41.         <url>http://jira.baidu.com/banseonurl>     
  42.     issueManagement>     
  43.         
  44.  <ciManagement>    
  45.       
  46.   <system/>    
  47.       
  48.   <url/>    
  49.       
  50.   <notifiers>    
  51.        
  52.    <notifier>    
  53.         
  54.     <type/>    
  55.         
  56.     <sendOnError/>    
  57.         
  58.     <sendOnFailure/>    
  59.         
  60.     <sendOnSuccess/>    
  61.         
  62.     <sendOnWarning/>    
  63.         
  64.     <address/>    
  65.         
  66.     <configuration/>    
  67.    notifier>    
  68.   notifiers>    
  69.  ciManagement>    
  70.      
  71.     <inceptionYear/>    
  72.          
  73.     <mailingLists>    
  74.           
  75.         <mailingList>     
  76.              
  77.             <name>Demoname>     
  78.                  
  79.             <post>[email protected]post>     
  80.                  
  81.             <subscribe>[email protected]subscribe>     
  82.                  
  83.             <unsubscribe>[email protected]unsubscribe>     
  84.                 
  85.             <archive>http:/hi.baidu.com/banseon/demo/dev/archive>     
  86.         mailingList>     
  87.     mailingLists>     
  88.          
  89.     <developers>     
  90.          
  91.         <developer>     
  92.              
  93.             <id>HELLO WORLDid>     
  94.                 
  95.             <name>banseonname>     
  96.                 
  97.             <email>[email protected]email>     
  98.                 
  99.             <url/>    
  100.                 
  101.             <roles>     
  102.                 <role>Project Managerrole>     
  103.                 <role>Architectrole>     
  104.             roles>    
  105.                 
  106.             <organization>demoorganization>     
  107.                 
  108.             <organizationUrl>http://hi.baidu.com/banseonorganizationUrl>     
  109.                 
  110.             <properties>     
  111.                 <dept>Nodept>     
  112.             properties>    
  113.                 
  114.             <timezone>-5timezone>     
  115.         developer>     
  116.     developers>     
  117.          
  118.     <contributors>    
  119.          
  120.      <contributor>    
  121.    <name/><email/><url/><organization/><organizationUrl/><roles/><timezone/><properties/>    
  122.      contributor>         
  123.     contributors>       
  124.          
  125.     <licenses>    
  126.           
  127.         <license>    
  128.              
  129.             <name>Apache 2name>     
  130.                 
  131.             <url>http://www.baidu.com/banseon/LICENSE-2.0.txturl>     
  132.                 
  133.             <comments>A business-friendly OSS licensecomments>     
  134.         license>     
  135.     licenses>     
  136.          
  137.     <scm>     
  138.              
  139.         <connection>     
  140.             scm:svn:http://svn.baidu.com/banseon/maven/banseon/banseon-maven2-trunk(dao-trunk)      
  141.         connection>     
  142.             
  143.         <developerConnection>     
  144.             scm:svn:http://svn.baidu.com/banseon/maven/banseon/dao-trunk      
  145.         developerConnection>    
  146.             
  147.         <tag/>           
  148.              
  149.         <url>http://svn.baidu.com/banseonurl>     
  150.     scm>     
  151.          
  152.     <organization>     
  153.          
  154.         <name>demoname>     
  155.             
  156.         <url>http://www.baidu.com/banseonurl>     
  157.     organization>    
  158.         
  159.     <build>    
  160.          
  161.   <sourceDirectory/>    
  162.       
  163.   <scriptSourceDirectory/>    
  164.       
  165.   <testSourceDirectory/>    
  166.       
  167.   <outputDirectory/>    
  168.       
  169.   <testOutputDirectory/>    
  170.       
  171.   <extensions>    
  172.        
  173.    <extension>    
  174.         
  175.     <groupId/>    
  176.         
  177.     <artifactId/>    
  178.         
  179.     <version/>    
  180.    extension>    
  181.   extensions>    
  182.       
  183.   <defaultGoal/>    
  184.       
  185.   <resources>    
  186.        
  187.    <resource>    
  188.         
  189.     <targetPath/>    
  190.         
  191.     <filtering/>    
  192.         
  193.     <directory/>    
  194.         
  195.     <includes/>    
  196.         
  197.     <excludes/>    
  198.    resource>    
  199.   resources>    
  200.       
  201.   <testResources>    
  202.        
  203.    <testResource>    
  204.     <targetPath/><filtering/><directory/><includes/><excludes/>    
  205.    testResource>    
  206.   testResources>    
  207.       
  208.   <directory/>    
  209.       
  210.   <finalName/>    
  211.       
  212.   <filters/>    
  213.       
  214.   <pluginManagement>    
  215.        
  216.    <plugins>    
  217.         
  218.     <plugin>    
  219.          
  220.      <groupId/>    
  221.          
  222.      <artifactId/>    
  223.          
  224.      <version/>    
  225.          
  226.      <extensions/>    
  227.          
  228.      <executions>    
  229.           
  230.       <execution>    
  231.            
  232.        <id/>    
  233.            
  234.        <phase/>    
  235.            
  236.        <goals/>    
  237.            
  238.        <inherited/>    
  239.            
  240.        <configuration/>    
  241.       execution>    
  242.      executions>    
  243.          
  244.      <dependencies>    
  245.           
  246.       <dependency>    
  247.        ......    
  248.       dependency>    
  249.      dependencies>         
  250.          
  251.      <inherited/>    
  252.          
  253.      <configuration/>    
  254.     plugin>    
  255.    plugins>    
  256.   pluginManagement>    
  257.       
  258.   <plugins>    
  259.        
  260.    <plugin>    
  261.     <groupId/><artifactId/><version/><extensions/>    
  262.     <executions>    
  263.      <execution>    
  264.       <id/><phase/><goals/><inherited/><configuration/>    
  265.      execution>    
  266.     executions>    
  267.     <dependencies>    
  268.          
  269.      <dependency>    
  270.       ......    
  271.      dependency>    
  272.     dependencies>    
  273.     <goals/><inherited/><configuration/>    
  274.    plugin>    
  275.   plugins>    
  276.  build>    
  277.      
  278.  <profiles>    
  279.       
  280.   <profile>    
  281.        
  282.    <id/>    
  283.        
  284.     <activeByDefault/>    
  285.         
  286.     <jdk/>    
  287.         
  288.     <os>    
  289.          
  290.      <name>Windows XPname>    
  291.          
  292.      <family>Windowsfamily>    
  293.          
  294.      <arch>x86arch>    
  295.          
  296.      <version>5.1.2600version>    
  297.     os>    
  298.         
  299.      <name>mavenVersionname>    
  300.          
  301.      <value>2.0.3value>    
  302.     property>    
  303.         
  304.      <exists>/usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/exists>    
  305.          
  306.      <missing>/usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/missing>    
  307.     file>    
  308.    activation>    
  309.        
  310.    <build>    
  311.     <defaultGoal/>    
  312.     <resources>    
  313.      <resource>    
  314.       <targetPath/><filtering/><directory/><includes/><excludes/>    
  315.      resource>    
  316.     resources>    
  317.     <testResources>    
  318.      <testResource>    
  319.       <targetPath/><filtering/><directory/><includes/><excludes/>    
  320.      testResource>    
  321.     testResources>    
  322.     <directory/><finalName/><filters/>    
  323.     <pluginManagement>    
  324.      <plugins>    
  325.           
  326.       <plugin>    
  327.        <groupId/><artifactId/><version/><extensions/>    
  328.        <executions>    
  329.         <execution>    
  330.          <id/><phase/><goals/><inherited/><configuration/>    
  331.         execution>    
  332.        executions>    
  333.        <dependencies>    
  334.             
  335.         <dependency>    
  336.          ......    
  337.         dependency>    
  338.        dependencies>    
  339.        <goals/><inherited/><configuration/>    
  340.       plugin>    
  341.      plugins>    
  342.     pluginManagement>    
  343.     <plugins>    
  344.          
  345.      <plugin>    
  346.       <groupId/><artifactId/><version/><extensions/>    
  347.       <executions>    
  348.        <execution>    
  349.         <id/><phase/><goals/><inherited/><configuration/>    
  350.        execution>    
  351.       executions>    
  352.       <dependencies>    
  353.            
  354.        <dependency>    
  355.         ......    
  356.        dependency>    
  357.       dependencies>    
  358.       <goals/><inherited/><configuration/>    
  359.      plugin>    
  360.     plugins>    
  361.    build>    
  362.        
  363.    <modules/>    
  364.        
  365.    <repositories>    
  366.         
  367.     <repository>    
  368.      <releases>    
  369.       <enabled/><updatePolicy/><checksumPolicy/>    
  370.      releases>    
  371.      <snapshots>    
  372.       <enabled/><updatePolicy/><checksumPolicy/>    
  373.      snapshots>    
  374.      <id/><name/><url/><layout/>    
  375.     repository>    
  376.    repositories>    
  377.        
  378.    <pluginRepositories>    
  379.             
  380.     <pluginRepository>    
  381.      <releases>    
  382.       <enabled/><updatePolicy/><checksumPolicy/>    
  383.      releases>    
  384.      <snapshots>    
  385.       <enabled/><updatePolicy/><checksumPolicy/>    
  386.      snapshots>    
  387.      <id/><name/><url/><layout/>    
  388.     pluginRepository>    
  389.    pluginRepositories>    
  390.        
  391.    <dependencies>    
  392.         
  393.     <dependency>    
  394.      ......    
  395.     dependency>    
  396.    dependencies>    
  397.        
  398.    <reports/>       
  399.        
  400.    <reporting>    
  401.     ......    
  402.    reporting>    
  403.        
  404.    <dependencyManagement>    
  405.     <dependencies>    
  406.          
  407.      <dependency>    
  408.       ......    
  409.      dependency>    
  410.     dependencies>    
  411.    dependencyManagement>    
  412.        
  413.    <distributionManagement>    
  414.     ......    
  415.    distributionManagement>    
  416.        
  417.    <properties/>    
  418.   profile>    
  419.  profiles>    
  420.      
  421.  <modules/>    
  422.          
  423.     <repositories>     
  424.          
  425.         <repository>    
  426.              
  427.          <releases>    
  428.               
  429.     <enabled/>    
  430.         
  431.     <updatePolicy/>    
  432.         
  433.     <checksumPolicy/>    
  434.    releases>    
  435.        
  436.    <snapshots>    
  437.     <enabled/><updatePolicy/><checksumPolicy/>    
  438.    snapshots>    
  439.        
  440.    <id>banseon-repository-proxyid>     
  441.        
  442.             <name>banseon-repository-proxyname>     
  443.                 
  444.             <url>http://192.168.1.169:9999/repository/url>     
  445.                 
  446.             <layout>defaultlayout>               
  447.         repository>     
  448.     repositories>    
  449.         
  450.     <pluginRepositories>    
  451.          
  452.   <pluginRepository>    
  453.    ......    
  454.   pluginRepository>    
  455.  pluginRepositories>    
  456.        
  457.          
  458.     <dependencies>     
  459.         <dependency>    
  460.        
  461.             <groupId>org.apache.mavengroupId>     
  462.                 
  463.             <artifactId>maven-artifactartifactId>     
  464.                 
  465.             <version>3.8.1version>     
  466.                 
  467.             <type>jartype>    
  468.                 
  469.             <classifier>classifier>    
  470.                 
  471.             <systemPath>systemPath>     
  472.                 
  473.             <exclusions>    
  474.              <exclusion>     
  475.                     <artifactId>spring-coreartifactId>     
  476.                     <groupId>org.springframeworkgroupId>     
  477.                 exclusion>     
  478.             exclusions>       
  479.                  
  480.             <optional>trueoptional>    
  481.         dependency>    
  482.     dependencies>    
  483.         
  484.     <reports>reports>    
  485.         
  486.  <reporting>    
  487.       
  488.   <excludeDefaults/>    
  489.       
  490.   <outputDirectory/>    
  491.       
  492.   <plugins>    
  493.        
  494.    <plugin>    
  495.         
  496.     <groupId/>    
  497.         
  498.     <artifactId/>    
  499.         
  500.     <version/>    
  501.         
  502.     <inherited/>    
  503.         
  504.     <configuration/>    
  505.         
  506.     <reportSets>    
  507.          
  508.      <reportSet>    
  509.           
  510.       <id/>    
  511.           
  512.       <configuration/>    
  513.           
  514.       <inherited/>    
  515.           
  516.       <reports/>    
  517.      reportSet>    
  518.     reportSets>    
  519.    plugin>    
  520.   plugins>    
  521.  reporting>    
  522.      
  523.  <dependencyManagement>    
  524.   <dependencies>    
  525.        
  526.    <dependency>    
  527.     ......    
  528.    dependency>    
  529.   dependencies>    
  530.  dependencyManagement>       
  531.          
  532.     <distributionManagement>    
  533.             
  534.         <repository>    
  535.              
  536.    <uniqueVersion/>    
  537.    <id>banseon-maven2id>     
  538.    <name>banseon maven2name>     
  539.             <url>file://${basedir}/target/deployurl>     
  540.             <layout/>    
  541.   repository>    
  542.        
  543.   <snapshotRepository>    
  544.    <uniqueVersion/>    
  545.    <id>banseon-maven2id>    
  546.             <name>Banseon-maven2 Snapshot Repositoryname>    
  547.             <url>scp://svn.baidu.com/banseon:/usr/local/maven-snapshoturl>     
  548.    <layout/>    
  549.   snapshotRepository>    
  550.        
  551.         <site>    
  552.               
  553.             <id>banseon-siteid>     
  554.                 
  555.             <name>business api websitename>     
  556.                 
  557.             <url>     
  558.                 scp://svn.baidu.com/banseon:/var/www/localhost/banseon-web      
  559.             url>     
  560.         site>    
  561.       
  562.   <downloadUrl/>    
  563.       
  564.   <relocation>    
  565.        
  566.    <groupId/>    
  567.        
  568.    <artifactId/>    
  569.        
  570.    <version/>    
  571.        
  572.    <message/>    
  573.   relocation>    
  574.       
  575.   <status/>           
  576.     distributionManagement>    
  577.         
  578.     <properties/>    
  579. project>    

你可能感兴趣的:(mvn)