maven项目站点生成

这次以配置简述的形势讲解,以下所有配置只需在父工程配置即可。

1.项目信息

[html]  view plain  copy
  1. <!-- 版本控制 -->  
  2.     <scm>  
  3.         <connection>scm:git:git@github.com:lastsweetop/account.git</connection>  
  4.         <developerConnection>scm:git:git@github.com:lastsweetop/account.git</developerConnection>  
  5.         <url>https://github.com/lastsweetop/account/blob/master</url>  
  6.     </scm>  
  7.   
  8.     <!-- 持续集成 -->  
  9.     <ciManagement>  
  10.         <system>Hudson</system>  
  11.         <url>http://${distribution.repository}:8080/hudson</url>  
  12.     </ciManagement>  
  13.   
  14.     <!-- 项目团队 -->  
  15.     <developers>  
  16.         <developer>  
  17.             <id>sweetop</id>  
  18.             <name>sweetop</name>  
  19.             <email>sweetop@189.cn</email>  
  20.             <timezone>8</timezone>  
  21.         </developer>  
  22.     </developers>  
  23.   
  24.     <!-- 项目授权 -->  
  25.     <licenses>  
  26.         <license>  
  27.             <name>Apache License,Version 2.0</name>  
  28.             <url>http://www.apache.org/licenses/LICENSE-2.0</url>  
  29.         </license>  
  30.     </licenses>  
  31.   
  32.     <!-- 问题跟踪 -->  
  33.     <issueManagement>  
  34.         <system>urltracker</system>  
  35.         <url>http://10.18.96.90/URTracker/Accounts/Login.aspx</url>  
  36.     </issueManagement>  


2.项目站点插件

[html]  view plain  copy
  1. <plugin>  
  2.                 <!-- 站点生成插件 -->  
  3.                 <groupId>org.apache.maven.plugins</groupId>  
  4.                 <artifactId>maven-site-plugin</artifactId>  
  5.                 <version>3.2</version>  
  6.                 <configuration>  
  7.                     <!-- 支持国际化 -->  
  8.                     <locales>zh_CN</locales>  
  9.                     <reportPlugins>  
  10.                         <plugin>  
  11.                             <!-- 生成javadoc文件 -->  
  12.                             <groupId>org.apache.maven.plugins</groupId>  
  13.                             <artifactId>maven-javadoc-plugin</artifactId>  
  14.                             <version>2.9</version>  
  15.                         </plugin>  
  16.                         <plugin>  
  17.                             <!-- 项目信息过滤 -->  
  18.                             <groupId>org.apache.maven.plugins</groupId>  
  19.                             <artifactId>maven-project-info-reports-plugin</artifactId>  
  20.                             <version>2.6</version>  
  21.                             <reportSets>  
  22.                                 <reportSet>  
  23.                                     <reports>  
  24.                                         <!-- index一定要生成,否则链接问题 -->  
  25.                                         <report>index</report>  
  26.                                         <report>dependencies</report>  
  27.                                         <report>project-team</report>  
  28.                                         <report>issue-tracking</report>  
  29.                                         <report>license</report>  
  30.                                         <report>scm</report>  
  31.                                         <report>cim</report>  
  32.                                         <report>modules</report>  
  33.                                         <report>plugins</report>  
  34.                                         <report>help</report>  
  35.                                         <report>summary</report>  
  36.                                     </reports>  
  37.                                 </reportSet>  
  38.                             </reportSets>  
  39.                         </plugin>  
  40.                         <plugin>  
  41.                             <!-- 源码查看生成 -->  
  42.                             <groupId>org.apache.maven.plugins</groupId>  
  43.                             <artifactId>maven-jxr-plugin</artifactId>  
  44.                             <version>2.3</version>  
  45.                             <configuration>  
  46.                                 <!-- 多模块聚合 -->  
  47.                                 <aggregate>true</aggregate>  
  48.                             </configuration>  
  49.                         </plugin>  
  50.                         <plugin>  
  51.                             <!-- 代码风格检查 -->  
  52.                             <groupId>org.apache.maven.plugins</groupId>  
  53.                             <artifactId>maven-checkstyle-plugin</artifactId>  
  54.                             <version>2.10</version>  
  55.                             <configuration>  
  56.                                 <!-- 使用maven社区代码风格 -->  
  57.                                 <configLocation>config/maven_checks.xml</configLocation>  
  58.                             </configuration>  
  59.                         </plugin>  
  60.                         <plugin>  
  61.                             <!-- 代码更改日志 -->  
  62.                             <groupId>org.apache.maven.plugins</groupId>  
  63.                             <artifactId>maven-changelog-plugin</artifactId>  
  64.                             <version>2.2</version>  
  65.                         </plugin>  
  66.                         <plugin>  
  67.                             <!-- 代码隐藏bug检查 -->  
  68.                             <groupId>org.apache.maven.plugins</groupId>  
  69.                             <artifactId>maven-pmd-plugin</artifactId>  
  70.                             <version>3.0</version>  
  71.                             <configuration>  
  72.                                 <!-- 多模块聚合 -->  
  73.                                 <aggregate>true</aggregate>  
  74.                             </configuration>  
  75.                         </plugin>  
  76.                         <plugin>  
  77.                             <!-- 测试覆盖率 -->  
  78.                             <groupId>org.codehaus.mojo</groupId>  
  79.                             <artifactId>cobertura-maven-plugin</artifactId>  
  80.                             <version>2.5.2</version>  
  81.                         </plugin>  
  82.                     </reportPlugins>  
  83.                 </configuration>  
  84.             </plugin>  


3.项目站点生成命令

[html]  view plain  copy
  1. mvn site  
如果本地想看一下,多个模块链接会出现问题,可以用下面命令将生成文件聚合在一处
[html]  view plain  copy
  1. clean site site:stage -DstagingDirectory=/Users/apple/site  
但是如想使用这个命令必须配置下面的发布管理配置
[html]  view plain  copy
  1. <distributionManagement>  
  2.         <site>  
  3.             <id>website</id>  
  4.             <url>file:///Users/apple/site/</url>  
  5.         </site>  
  6.     </distributionManagement>  

4.项目站点自定义

在src/site下创建site.xml文件
[html]  view plain  copy
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <project name="Account" xmlns="http://maven.apache.org/DECORATION/1.0.0"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">  
  5.     <bannerLeft>  
  6.         <!-- 左上角图片 -->  
  7.         <name>maven</name>  
  8.         <src>images/apache-maven-project.png</src>  
  9.         <href>http://projects.apache.org/</href>  
  10.     </bannerLeft>  
  11.     <bannerRight>  
  12.         <!-- 右上角图片 -->  
  13.         <name>java</name>  
  14.         <src>images/java_logo.jpg</src>  
  15.         <href>http://www.java.com</href>  
  16.     </bannerRight>  
  17.     <!-- 版本信息放在右边 -->  
  18.     <version position="right" />  
  19.     <!-- 发布信息放在右边 -->  
  20.     <publishDate position="right" />  
  21.     <body>  
  22.         <breadcrumbs>  
  23.             <!-- 横条链接 -->  
  24.             <item name="lastsweetop" href="http://blog.csdn.net/lastsweetop" />  
  25.             <item name="account" href="http://192.168.115.5:8080/account/index.html"/>  
  26.         </breadcrumbs>  
  27.         <menu ref="parent"/>  
  28.         <!-- 项目信息报告 inherit表示子模块继承父模块-->  
  29.         <menu ref="reports" inherit="top"></menu>  
  30.     </body>  
  31.     <skin>  
  32.         <!-- 谷歌皮肤 -->  
  33.         <groupId>com.googlecode.fluido-skin</groupId>  
  34.         <artifactId>fluido-skin</artifactId>  
  35.         <version>1.3</version>  
  36.     </skin>  
  37. </project>  

5.效果



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值