The minimum requirement for a POM are the following:
project root
modelVersion - should be set to 4.0.0
groupId - the id of the project's group.
artifactId - the id of the artifact (project)
version - the version of the artifact under the specified group
Here's an example:
A POM requires that its groupId, artifactId, and version be configured. These three values form the project's fully qualified artifact name.
modelVersion指定了當(dāng)前POM模型的版本,對(duì)于Maven2及Maven 3來(lái)說(shuō),它只能是4.0.0
groupId定義了項(xiàng)目屬于哪個(gè)組,這個(gè)組往往和項(xiàng)目所在的組織或公司存在關(guān)聯(lián),如果你的公司是mycom,有一個(gè)項(xiàng)目為myapp,那么groupId就應(yīng)該是com.mycom.myapp
artifactId定義了當(dāng)前Maven項(xiàng)目在組中唯一的ID
version指定了項(xiàng)目當(dāng)前的版本,SNAPSHOT意為快照,說(shuō)明該項(xiàng)目還處于開(kāi)發(fā)中,是不穩(wěn)定的版本
此外,如果配置的其他細(xì)節(jié)沒(méi)有被指定,Maven會(huì)使用它們的默認(rèn)值
Furthermore,你可以看到,在Minimal POM中未指定倉(cāng)庫(kù),如果你的項(xiàng)目是采用最小的pom,那么它是會(huì)繼承所謂的Super POM,所以就算你沒(méi)有指定倉(cāng)庫(kù),maven也知道所有的依賴直接從網(wǎng)上(http://repo1.maven.org/maven2)下載
project root
modelVersion - should be set to 4.0.0
groupId - the id of the project's group.
artifactId - the id of the artifact (project)
version - the version of the artifact under the specified group
Here's an example:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.juvenxu.mvnbook</groupId>
<artifactId>hello-world</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.juvenxu.mvnbook</groupId>
<artifactId>hello-world</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
A POM requires that its groupId, artifactId, and version be configured. These three values form the project's fully qualified artifact name.
modelVersion指定了當(dāng)前POM模型的版本,對(duì)于Maven2及Maven 3來(lái)說(shuō),它只能是4.0.0
groupId定義了項(xiàng)目屬于哪個(gè)組,這個(gè)組往往和項(xiàng)目所在的組織或公司存在關(guān)聯(lián),如果你的公司是mycom,有一個(gè)項(xiàng)目為myapp,那么groupId就應(yīng)該是com.mycom.myapp
artifactId定義了當(dāng)前Maven項(xiàng)目在組中唯一的ID
version指定了項(xiàng)目當(dāng)前的版本,SNAPSHOT意為快照,說(shuō)明該項(xiàng)目還處于開(kāi)發(fā)中,是不穩(wěn)定的版本
此外,如果配置的其他細(xì)節(jié)沒(méi)有被指定,Maven會(huì)使用它們的默認(rèn)值
Furthermore,你可以看到,在Minimal POM中未指定倉(cāng)庫(kù),如果你的項(xiàng)目是采用最小的pom,那么它是會(huì)繼承所謂的Super POM,所以就算你沒(méi)有指定倉(cāng)庫(kù),maven也知道所有的依賴直接從網(wǎng)上(http://repo1.maven.org/maven2)下載