分享

Maven中pom.xml常用元素说明

 jackeyqing 2020-07-06
复制代码
<project xmlns="http://maven./POM/4.0.0" xmlns:xsi="http://www./2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven./POM/4.0.0 http://maven./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.</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>
复制代码

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约