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指定了當前POM模型的版本,對于Maven2及Maven 3來說,它只能是4.0.0
groupId定義了項目屬于哪個組,這個組往往和項目所在的組織或公司存在關聯,如果你的公司是mycom,有一個項目為myapp,那么groupId就應該是com.mycom.myapp
artifactId定義了當前Maven項目在組中唯一的ID
version指定了項目當前的版本,SNAPSHOT意為快照,說明該項目還處于開發中,是不穩定的版本
此外,如果配置的其他細節沒有被指定,Maven會使用它們的默認值
Furthermore,你可以看到,在Minimal POM中未指定倉庫,如果你的項目是采用最小的pom,那么它是會繼承所謂的Super POM,所以就算你沒有指定倉庫,maven也知道所有的依賴直接從網上(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指定了當前POM模型的版本,對于Maven2及Maven 3來說,它只能是4.0.0
groupId定義了項目屬于哪個組,這個組往往和項目所在的組織或公司存在關聯,如果你的公司是mycom,有一個項目為myapp,那么groupId就應該是com.mycom.myapp
artifactId定義了當前Maven項目在組中唯一的ID
version指定了項目當前的版本,SNAPSHOT意為快照,說明該項目還處于開發中,是不穩定的版本
此外,如果配置的其他細節沒有被指定,Maven會使用它們的默認值
Furthermore,你可以看到,在Minimal POM中未指定倉庫,如果你的項目是采用最小的pom,那么它是會繼承所謂的Super POM,所以就算你沒有指定倉庫,maven也知道所有的依賴直接從網上(http://repo1.maven.org/maven2)下載