<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2011/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POS/4.0.0 http://maven.apache.org/maven-v4_0_0.xsb"> <modelVersion>4.0.0</modelVersion> <groupId>com.lnn.helloworld</groupId> <artifactId>hello-world</artifactId> <version>1.0-SNAPSHOT</version> <name>Maven Hello World Project</name> .... </project>
含义解析apache
属性 | 含义 | 是否必要 |
---|---|---|
modelVersion | 指定当前POM模型版本,对于 Maven2 及 Maven 3 ,它只能是 4.0.0 | true |
groupId | 定义项目属于哪一个组 | true |
artifactId | 定义项目组中的惟一ID | true |
version | 定义项目版本号 | true |
name | 声明一个对用户更加友好的项目名称 | false |
<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.7</version> <scope>test</scope> </dependency> </dependencies>
含义解析:maven
属性 | 含义 | 是否必要 |
---|---|---|
dependencies | 能够包含多个dependency元素声明项目依赖 | true |
dependency | 表明一个项目依赖 | true |
groupId | 依赖所属的项目组 | true |
artifactId | 依赖在该项目组中的惟一ID | true |
version | 依赖的版本号 | true |
scope | 依赖范围; 默认:compile:对主代码和测试都有效;test(只对测试有效)测试 |
false |