在开始编写代码之前,让我们先定制一些项目的信息。 我们想要做的是添加一些关于项目许可证,组织以及项目相关开发人员的一些信息。 这些都是你期望能在大部分项目中看到的标准信息。下面的文档展示了提供组织信息,许可证信息和开发人员信息的 XML 。
Example 4.2. 为 pom.xml 添加组织,法律和开发人员信息
<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/maven-v4_0_0.xsd">
...
<name>simple-weather</name>
<url>http://www.sonatype.com</url>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<organization>
<name>Sonatype</name>
<url>http://www.sonatype.com</url>
</organization>
<developers>
<developer>
<id>jason</id>
<name>Jason Van Zyl</name>
<email>[email protected]</email>
<url>http://www.sonatype.com</url>
<organization>Sonatype</organization>
<organizationUrl>http://www.sonatype.com</organizationUrl>
<roles>
<role>developer</role>
</roles>
<timezone>-6</timezone>
</developer>
</developers>
...
</project>
Example 4.2, “为 pom.xml 添加组织,法律和开发人员信息” 中的省略号是为了使代码清单变得简短。 当你在
pom.xml 中看到 project 元素的开始标签后面跟着
“…” 或者在 project 元素的结束标签前有 “…” ,这说明我们没有展示整个
pom.xml
文件。在上述情况中,licenses,organization 和
developers 元素是加在 dependencies
元素之前的。

