Maven:站点生成

一、生成简单的站点 
用户可以让Maven自动生成一个Web站点,以Web的形式发布如项目描述、版本控制系统地址、缺陷跟踪系统地址等,更便捷、更快速地为团队提供项目当前的状态信息; 
1.在pom.xml文件中,配置maven-site-plugin插件(Maven的site生命周期如果默认绑定了site插件就可以不配置): 
<project> 
    ... ...  
    <build> 
        <plugins> 
            <plugin> 
                <groupId>org.apache.maven.plugins</groupId> 
                <artifactId>maven-site-plugin</artifactId> 
                <version>3.3</version> 
            </plugin> 
        </plugins> 
    </build> 
    ... ...  
</project> 
2.配置正确版本之后,在项目之下运行mvn site就能直接生成一个最简单的站点; 
C:\Users\chengxiang.peng.QUNARSERVERS\QunarGitSources\phone_spider_project>mvn site 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building check phone 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-site-plugin:3.3:site (default-site) @ phoneproject --- 
[WARNING] Report plugin org.apache.maven.plugins:maven-project-info-reports-plugin has an empty version. 
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. 
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. 
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.9 
[WARNING] No project URL defined - decoration links will not be relativized! 
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin. 
[INFO] Generating "Dependencies" report    --- maven-project-info-reports-plugin:2.9 
[INFO] Generating "Dependency Convergence" report    --- maven-project-info-reports-plugin:2.9 
[INFO] Generating "Dependency Information" report    --- maven-project-info-reports-plugin:2.9 
[INFO] Generating "About" report    --- maven-project-info-reports-plugin:2.9 
[INFO] Generating "Plugin Management" report    --- maven-project-info-reports-plugin:2.9 
[INFO] Generating "Plugins" report    --- maven-project-info-reports-plugin:2.9 
[INFO] Generating "Summary" report    --- maven-project-info-reports-plugin:2.9 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 29.989 s 
[INFO] Finished at: 2016-10-20T12:09:41+08:00 
[INFO] Final Memory: 26M/357M 
[INFO] ------------------------------------------------------------------------ 
3.待Maven运行完成后,可以再项目的target/site/目录下找到Maven生成的站点文件,包括dependencies.html、dependency-convergence.html、index.html和css、images文件夹; 
Project [Phoneproject] config target images dependencies.html dependency-convergence,html dependency-info.html Index.html plugin-management.html plugins.html project-info.html project-summary.htm .gitignore PhoneProject.iml m pom.xml External Libraries
4.点击index.html文件,打开生成的站点; 
C O localhost:63342/PhoneProject/target/site/project-info.htmI check phone Last Published: 2016-10-20 | version: 1.0-SNAPSHOT check phone Project Documentation Project Information Dependencies Dependency Convergence Dependency Information About Plugin Management Plugins Summary maven Project Information This document provides an overview of the various documents and links that are part of this project's general information. All of this content is automatically generated by Maven on behalf of the project. Overview Document Dependencies Dependency Convergence Dependency Information About Plugin Management Plugins Summary Description This document lists the project's dependencies and provides information on each dependency. This document presents the convergence of dependency versions across the entire project, and its sub modules. This document describes how to to include this project as a dependency using various dependency management tools. There is currently no description associated with this project. This document lists the plugins that are defined through pluginManagement. This document lists the build plugins and the report plugins used by this project. This document lists other related information of this project Copyright 2016. All Rights Reserved.
二、丰富项目的信息 
1.默认情况下,Maven生成的站点包含了很多项目的信息链接,这其实是由一个名为maven-project-info--reports-plugin的插件(Maven3中,该插件内置在maven-site-plugin中,Maven2内置在核心源码中)生成的;该插件会基于POM配置生成下列项目信息报告(见上站点截图): 
  关于(about):项目描述; 
  持续集成(Continuous Integeration):项目持续化集成服务器信息; 
  依赖(Dependencies):项目依赖信息,包括传递性依赖、依赖图、依赖许可证以及依赖文件的大小、所包含的类的数目; 
  依赖收敛(Dependency Convergence):针对多个模块项目生成,提供一些依赖健康状况分析; 
  依赖管理(Dependency Management):基于项目的 依赖管理生成的报告; 
  问题追踪(Issue Tracking):项目问题追踪系统信息; 
  邮件列表(Mailing Lists):项目的邮件列表信息; 
  插件管理(Plugin Management):项目所有项目插件的列表; 
  项目许可证(Project License):项目许可证信息; 
  项目概述(Project Summary):项目概述包括坐标、名称、描述等; 
  项目团队(Project Team):项目团队信息; 
  源码仓库(Source Repository):项目的源码仓库信息; 
2.Maven不会凭空生成信息,只有用户在POM中提供了相关配置后,站点才可能包含这些信息的报告。为了让站点包含完整的项目信息,需要配置PMO如下: 
<project> 
    ... ...  
    <url>http://phoneproject.qunar.com</url> 
    <!--项目描述信息--> 
    <description>check phone description.</description> 
    <!--源码仓库信息--> 
    <scm> 
        <connection>scm:git:http://gitlab.corp.chengxiang.com/mobile_hotel_res/phone_spider_project</connection> 
        <developerConnection>scm:git:git@gitlab.corp.chengxiang.com:mobile_
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值