项目信息配置
POM 元数据描述项目基本信息,用于生成项目站点和报告。
基本信息配置
XML
<project>
<!-- 项目名称 -->
<name>My Application</name>
<!-- 项目描述 -->
<description>基于 Spring Boot 的示例应用</description>
<!-- 项目主页 -->
<url>https://example.com/my-app</url>
<!-- 项目 inceptionYear -->
<inceptionYear>2023</inceptionYear>
<!-- 组织信息 -->
<organization>
<name>Example Corp</name>
<url>https://example.com</url>
</organization>
</project>
开发者信息
XML
<developers>
<developer>
<id>dev001</id>
<name>张三</name>
<email>zhangsan@example.com</email>
<url>https://github.com/zhangsan</url>
<organization>Example Corp</organization>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+8</timezone>
</developer>
</developers>
developer 字段说明
| 字段 | 说明 |
|---|---|
| id | 开发者唯一标识 |
| name | 姓名 |
| 邮箱 | |
| url | 个人主页 |
| roles | 角色列表 |
| timezone | 时区 |
许可证信息
XML
<licenses>
<license>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
<comments>开源许可证</comments>
</license>
</licenses>
license 字段说明
| 字段 | 说明 |
|---|---|
| name | 许可证名称 |
| url | 许可证链接 |
| distribution | 发布方式(repo/manual) |
| comments | 许可证说明 |
SCM 源码管理
XML
<scm>
<connection>scm:git:git://github.com/example/my-app.git</connection>
<developerConnection>scm:git:ssh://github.com/example/my-app.git</developerConnection>
<url>https://github.com/example/my-app</url>
<tag>HEAD</tag>
</scm>
问题跟踪
XML
<issueManagement>
<system>GitHub</system>
<url>https://github.com/example/my-app/issues</url>
</issueManagement>
CI 管理
XML
<ciManagement>
<system>Jenkins</system>
<url>https://jenkins.example.com/my-app</url>
<notifiers>
<notifier>
<type>email</type>
<address>dev@example.com</address>
</notifier>
</notifiers>
</ciManagement>
生成项目站点
Bash
# 生成项目信息站点
mvn site
# 输出位置
target/site/index.html
站点插件配置
XML
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.4.1</version>
</plugin>
</plugins>
</reporting>
要点总结
- name、description 用于项目描述,IDE 和仓库会显示
- developers 记录团队成员信息
- licenses 说明项目许可证,发布时必要
- SCM 配置源码仓库地址,用于版本发布
- mvn site 可生成项目信息站点文档
📝 发现内容有误?点击此处直接编辑