Maven pom.xml标签含义

来源:互联网 发布:php trait 编辑:程序博客网 时间:2024/05/16 15:40

Maven中pom.xml里标签的含义

POM全称 Project Object Model 项目对象模型


<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.xml的版本 -->  <modelVersion>4.0.0</modelVersion>  <!-- 主项目的标识属于哪个项目   (公司网址+项目名) -->  <groupId>com.ouyang.maven</groupId>  <!--模块标识,实际项目的模块(项目名+模块名)-->  <artifactId>maven-test</artifactId>  <!--  第一个0大版本号,第二个0表示分支版本号,第三个0表示小版本号   SNAPSHOT 快照  ALPHA 内部测试  BETA 公测  RELEASE 稳定  GA 正式发布-->  <version>0.0.1-SNAPSHOT</version>  <!-- 默认是jar   war zip pom -->  <packaging>jar</packaging><!-- 项目的描述名 -->  <name>maven-test</name>  <!-- 项目的地址 -->  <url>http://maven.apache.org</url>  <!-- 项目描述 -->  <description></description>  <!-- 开发人员 -->  <developers></developers>  <!-- 许可证 -->  <licenses></licenses>  <!-- 组织信息 -->  <organization></organization>    <properties>    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  </properties>  <dependencies>    <dependency>      <groupId>junit</groupId>      <artifactId>junit</artifactId>      <version>3.8.1</version>      <!--       依赖范围         compile 默认的范围,编译测试运行都有效provided 在编译测试时有效runtime 测试和运行时有效test 测试时有效system 在编译测试时有效(需要与本地系统做关联)import 导入的范围,只做用dependcyManagement中,表示从其他的pom中导入dependecy的配置      -->      <scope>test</scope>      <!-- 依赖是否可选 -->      <!-- <optional>false</optional> -->      <!-- 排除依赖传递列表 -->      <exclusions>      <!-- <exclusion>          <groupId></groupId>          <artifactId></artifactId>        </exclusion> -->      </exclusions>    </dependency>  </dependencies>  <!-- 依赖管理(可以提供父依赖)-->  <dependencyManagement>  <!-- <dependencies>  <dependency></dependency>  </dependencies> -->  </dependencyManagement>    <build>    <!-- 插件列表 -->  <plugins>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-source-plugin</artifactId>  <version>3.0.1</version>  <executions>  <execution>  <phase>package</phase>  <goals>  <goal>jar-no-fork</goal>  </goals>  </execution>  </executions>  </plugin>  </plugins>  </build>  <!-- 在子模块中对父模块pom的继承 -->  <!-- <parent></parent> -->  <!-- 聚合多个运行的maven项-->  <!-- <modules></modules> --></project>


1 0
原创粉丝点击