maven pom.xml記錄

<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/xsd/maven-4.0.0.xsd">
        <!-- 上面的信息的約束maven的寫法-->                               
 
        <modelVersion>4.0.0</modelVersion>
        <!--聲明項目描述符遵循哪個POM模型版本。模型自己的版本不多改變,雖然如此,但它仍然是必不可少的,這是爲了當Maven引入了新的特性或者其餘模型變動的時候,確保穩定性。--> 

        <groupId>im.yuecai</groupId>
        <!--項目或者組織的惟一標誌-->
        <artifactId>plan</artifactId>
        <!--項目的模塊座標-->
        <version>0.0.1-SNAPSHOT</version>
        <packaging>pom</packaging>
        <!--項目產生的構件類型或者說打包機制-->  
        <name>plan</name>
        <!--用戶描述項目的名稱-->
         <url>http://maven.apache.org</url>
         <!--開發團隊網站-->
                
         <description>       
              項目的詳細描述, Maven 產生的文檔用。 
         </description>

         <properties>
            <plan.version>0.0.1-SNAPSHOT</plan.version>
            <framework.all.version>0.0.1-SNAPSHOT</framework.all.version>
            <mysql.version>5.1.6</mysql.version>
            <copyright.year>2014 </copyright.year>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <!--是爲pom定義一些常量,在pom中的其它地方能夠直接引用 -->          
         </properties>
 
         <modules>
          <!-- 模塊(有時稱做子項目) 被構建成項目的一部分。列出的每一個模塊元素是指向該模塊的目錄的相對路徑 -->
          <module>plan-model</module>
          <module>plan-dao</module>
          <module>plan-interfaces</module>
          <module>plan-services</module>
          <module>plan-app</module>
         </modules>
        
         <dependencies>
            <!--描述了項目相關的全部依賴 -->
            <dependency>
              <groupId>junit</groupId>
              <!--依賴的group ID-->
              <artifactId>junit</artifactId>
              <!--依賴的artifact ID-->
              <version>3.8.1</version>
              <!--依賴的版本號。 在Maven 2裏, 也能夠配置成版本號的範圍。-->
              <scope>test</scope>
              <!--依賴範圍。在項目發佈過程當中,幫助決定哪些構件被包括進來。欲知詳情請參考依賴機制。 
                - compile :默認範圍,用於編譯   
                - provided:相似於編譯,但支持你期待jdk或者容器提供,相似於classpath   
                - runtime: 在執行時須要使用   
                - test:    用於test任務時使用   
                - system: 須要外在提供相應的元素。經過systemPath來取得   
                - systemPath: 僅用於範圍爲system。提供相應的路徑   
                - optional:   當項目自身被依賴時,標註依賴是否傳遞。用於連續依賴時使用-->  
            </dependency>
          </dependencies>
           <distributionManagement>
           <!--項目分發信息,在執行mvn deploy後表示要發佈的位置。有了這些信息就能夠把網站部署到遠程服務器或者把構件部署到遠程倉庫。-->
              <repository>
              <!--部署項目產生的構件到遠程倉庫須要的信息-->
               <id>releases</id>
               <url>http://192.168.1.XXX:8081/nexus/content/repositories/releases</url>
              </repository>
              <snapshotRepository>
              <!--構件的快照部署的信息-->  
               <id>snapshots</id>
               <url>http://192.168.1.XXX:8081/nexus/content/repositories/snapshots</url>
              </snapshotRepository>
            </distributionManagement>
            <build>
            <!--構建項目須要的信息-->
              <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
               <!--該元素設置了項目源碼目錄,當構建項目的時候,構建系統會編譯目錄裏的源碼。該路徑是相對於pom.xml的相對路徑。-->
              <outputDirectory>${basedir}/target/classes</outputDirectory>
               <!--被編譯過的應用程序class文件存放的目錄。-->
              <resources>
              <!--描述了項目相關的全部資源路徑列表,例如和項目相關的屬性文件,這些資源被包含在最終的打包文件裏。-->
               <resource>
               <!--描述了項目相關或測試相關的全部資源路徑-->
                <directory>${basedir}/src/main/java</directory>
                <includes>
                <!--包含的模式列表-->
                 <include>**/*.xml</include>
                 <include>**/*.properties</include>
                </includes>
                <excludes>
                <!--排除的模式列表-->
                 <exclude>**/*.java</exclude>
                </excludes>
                <filtering>true</filtering>
                 <!--是否使用參數值代替參數名。參數值取自properties元素或者文件裏配置的屬性,文件在filters元素裏列出。-->
               </resource>
              </resources>
              <plugins>
               <!--使用的插件列表 。-->
               <plugin>
               <!--plugin元素包含描述插件所須要的信息。-->
                <groupId>org.apache.maven.plugins</groupId>
                <!--插件在倉庫裏的group ID-->
                <artifactId>maven-compiler-plugin</artifactId>
                <!--插件在倉庫裏的artifact ID-->
                <version>2.3.2</version>
                <!--被使用的插件的版本(或版本範圍)-->
                <configuration>
                <!--被使用的插件的配置-->
                 <forkMode>once</forkMode>
                 <argLine>-Dfile.encoding=UTF-8</argLine>
                 <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>
               <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <configuration>
                 <attach>true</attach>
                </configuration>
                <executions>
                <!--在構建生命週期中執行一組目標的配置。每一個目標可能有不一樣的配置。-->
                 <execution>
                  <!--execution元素包含了插件執行須要的信息-->
                  <phase>compile</phase>
                  <!--綁定了目標的構建生命週期階段,若是省略,目標會被綁定到源數據裏配置的默認階段-->
                  <goals>
                  <!--配置的執行目標-->
                   <goal>jar</goal>
                  </goals>
                 </execution>
                </executions>
               </plugin>
              </plugins>
             </build>
</project>

 子pom.xml文件相關信息java

 <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/xsd/maven-4.0.0.xsd">

             <!-- 上面的信息的約束maven的寫法--> 
             <modelVersion>4.0.0</modelVersion>
             <parent>
             <!--父項目的座標。-->
              <groupId>im.yuecai</groupId>
              <!--被繼承的父項目的惟一標識符-->
              <artifactId>plan</artifactId>
              <version>0.0.1-SNAPSHOT</version>
             </parent>
             <artifactId>plan-app</artifactId>
             <packaging>war</packaging>
             <name>plan-app</name>
              <dependencies>
              <!--該元素描述了項目相關的全部依賴。-->
              <dependency>
               <groupId>im.yuecai</groupId>
               <artifactId>plan-services</artifactId>
               <version>${project.version}</version>
              </dependency>
              <dependency>
               <groupId>im.yuecai</groupId>
               <artifactId>common-web</artifactId>
               <version>0.0.1-SNAPSHOT</version>
              </dependency>
              <dependency>
               <groupId>org.springframework</groupId>
               <artifactId>spring-oxm</artifactId>
               <version>3.1.2.RELEASE</version>
              </dependency>                   
              <dependency>
               <groupId>cn.bidlink.monitor</groupId>
                <!--項目依賴的groupId-->
               <artifactId>monitor-client</artifactId>
               <!--項目依賴的artifactId-->
               <version>0.0.3-SNAPSHOT</version>
                <!--項目依賴的版本-->
               <exclusions>
               <!--當計算傳遞依賴時, 從依賴構件列表裏,列出被排除的依賴構件集。即告訴maven你只依賴指定的項目,不依賴項目的依賴。此元素主要用於解決版本衝突問題--> 
                <exclusion>
                   <groupId>junit</groupId>
                   <artifactId>junit</artifactId>
                </exclusion>
               </exclusions>
              </dependency> 
                 
             </dependencies>
             <build>
              <!--構建項目須要的信息-->
              <filters>
                <!--當filtering開關打開時,使用到的過濾器屬性文件列表-->
               <filter>src/main/resources/filters/filter-${env}.properties</filter>
              </filters>
              <resources>
              <!--描述了項目相關的全部資源路徑列表-->
               <resource>
               <!--這個元素描述了項目相關或測試相關的全部資源路徑-->
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <!--是否使用參數值代替參數名。參數值取自properties元素或者文件裏配置的屬性,文件在filters元素裏列出。-->
                <excludes>
                <!--排除的模式列表,例如**/*.xml-->
                 <exclude>filters/**</exclude>
                </excludes>
               </resource>
              </resources>
             </build>
             <!-- 各類環境的配置信息 -->
             <profiles>
              <!-- 開發環境的配置信息 -->
              <profile>
               <id>dev</id>
               <properties>
                <env>dev</env>
               </properties>
               <!-- 默認是本地開發環境 -->
               <activation>
                <activeByDefault>true</activeByDefault>
               </activation>
              </profile>
              <profile>
               <id>test</id>
               <properties>
                <env>test</env>
               </properties>
              </profile>
              <profile>
               <id>pub</id>
               <properties>
                <env>pub</env>
               </properties>
              </profile>
             </profiles>
            </project>
相關文章
相關標籤/搜索