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">
  <!--指定了當前pom的版本-->
  <modelVersion>4.0.0</modelVersion>

  <!--坐標信息  start-->
  <groupId>反寫的公司網址+項目名</groupId> <!--主項目標識-->
  <artifactId>項目名+模塊名</artifactId>
  <!--第一個0表示大版本號
    第二個0表示分支版本號
    第三個0標識小版本號
    0.0.1SNAPSHOT
    snapshot快照
    alpha內測
    beta公測
    Release穩定
    GA正式發布
    -->
  <version></version>
  <!--打包方式:默認是jar
    war  zip  pom
  -->
  <packaging></packaging>
  <!--坐標信息  end-->

  <!--項目描述名-->
  <name>hi</name>
  <!--項目地址-->
  <url>http://maven.apache.org</url>
  <!--項目描述-->
  <description></description>
  <!--開發人員列表-->
  <developers></developers>
  <!--許可證信息-->
  <license></license>
  <!--組織信息-->
  <organization></organization>
  
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <!--依賴列表-->
  <dependencies>
    <!--依賴項-->
    <dependency>
      <!--項目坐標 start-->
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <type></type>
      <scope>test</scope><!--指依賴范圍-->
      <!--設置依賴范圍是否可選:默認false-->
      <optional></optional>
      <!--排除依賴傳遞列表-->
      <executions>
        <execution></execution>
      </executions>
      <!--項目坐標 end-->
    </dependency>
  </dependencies>
  
  <!--依賴的管理-->
  <!--不會運行,即不會調用到依賴中
    一般定義在父模塊中,供子模塊調用
  -->
  <dependencyManagement>
    <dependencies>
        <dependency></dependency>
    </dependencies>
  </dependencyManagement>
  <!--提供支持-->
  <build>
        <!--插件列表-->
          <plugins>
              <plugin>
                <!--坐標-->
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-source-plugin</artifactId>
                  <version>2.4</version>
                  <executions>
                      <execution>
                          <phase>package</phase>
                          <goals>
                              <goal>jar-no-fork</goal>
                          </goals>
                      </execution>
                  </executions>
              </plugin>
          </plugins>
  </build>
  <!--子模塊對父模塊的繼承-->
  <parent></parent>
  <!--聚合多個模塊進行編譯,可多個子項-->
  <modules>
    <module></module>
  </modules>
   
</project>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM