淘宝商城(天猫)高级技术专家.3年研发+3年性能测试调优/系统测试+4年团队管理与测试架构、研发系统实践. 新舞台新气象, 深化测试基础架构及研发架构,希望能在某个技术领域成为真正的技术大牛。欢迎荐才http://bbs.51testing.com/viewthread.php?tid=120496&extra=&page=1 .邮件: jianzhao.liangjz@alibaba-inc.com,MSN:liangjianzhao@163.com.微博:http://t.sina.com.cn/1674816524

搭建CruiseControl2.8.2+maven2.1+cobertura+checkstyle+findbug持续集成环境

上一篇 / 下一篇  2009-06-05 22:51:00 / 个人分类:java性能监控与调优

参考:

http://rdc.taobao.com/blog/qa/?p=1822

http://rdc.taobao.com/blog/qa/?p=669

http://emma.sourceforge.net/maven-emma-plugin/goals.html

http://foxgem.javaeye.com/blog/24620

 

 

下载:CruiseControl-2.8.2.exe,maven-2.1.0并参考前述url设置M2_HOME,PATH变量. 

第一步先配置pom.xml  

依照maven权威指南 http://www.sonatype.com/books/maven-book/reference_zh/web.html 下载第五章样例simple-webapp

 

参考http://mojo.codehaus.org/cobertura-maven-plugin/usage.html 配置coberturajetty, checkstyle, pmd, findbug等相关的 pom.xml.配置完成需要单独测试pom.xml是否正确.

 

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.0http://maven.apache.org/maven-v4_0_0.xsd">

 <modelVersion>4.0.0</modelVersion>

 <groupId>org.sonatype.mavenbook.ch05</groupId>

 <artifactId>simple-webapp</artifactId>

 <version>1-SNAPSHOT</version>

 <packaging>war</packaging>

 <name>Chapter 5 Simple Web Application Project</name>

 <url>http://sonatype.com/book</url>

 <dependencies>

   <dependency>

     <groupId>junit</groupId>

     <artifactId>junit</artifactId>

     <version>3.8.1</version>

     <scope>test</scope>

   </dependency>

   <dependency>

     <groupId>org.apache.geronimo.specs</groupId>

     <artifactId>geronimo-servlet_2.4_spec</artifactId>

     <version>1.1.1</version>

   </dependency>

 </dependencies>

 

 <!--

 <parent>

    <artifactId>parent</artifactId>

    <groupId>org.sonatype.mavenbook.ch05</groupId>

    <version>1-SNAPSHOT</version>

 </parent>

 -->

 

 <build>

 

    <finalName>simple-webapp</finalName>

   <plugins>

   

     <plugin>

       <artifactId>maven-assembly-plugin</artifactId>

       <configuration>

         <descriptorRefs>

           <descriptorRef>project</descriptorRef>

         </descriptorRefs>

       </configuration>

       <executions>

         <execution>

           <id>examples</id>

           <phase>package</phase>

           <goals>

             <goal>attached</goal>

           </goals>

         </execution>

       </executions>

     </plugin>

     

     

   <plugin>

                           <groupId>org.mortbay.jetty</groupId>

                           <artifactId>maven-jetty-plugin</artifactId>

                           

                           <version>6.1.12</version>

                           

                           <configuration>

                                  <scanIntervalSeconds>10</scanIntervalSeconds>

                                  <stopKey>foo</stopKey>

                                  <stopPort>9999</stopPort>

                           </configuration>

                                  <!--

                           <executions>

                           

                                  <execution>

                                         <id>start-jetty</id>

                                         <phase>pre-integration-test</phase>

                                         <goals>

                                                <goal>run</goal>

                                         </goals>

                                         <configuration>

                                                <scanIntervalSeconds>10</scanIntervalSeconds>

                                                <daemon>true</daemon>

                                         </configuration>

                                  </execution>

                           

                                         <execution> <id>stop-jetty</id>

                                         <phase>post-integration-test</phase> <goals> <goal>stop</goal>

                                         </goals> </execution>

             

                           </executions>

                           -->

                    </plugin>

     <plugin>

       <artifactId>maven-compiler-plugin</artifactId>

       <configuration>

         <source>1.6</source>

         <target>1.6</target>

       </configuration>

     </plugin>  

     

              

                     <plugin>

       <groupId>org.codehaus.mojo</groupId>

       <artifactId>cobertura-maven-plugin</artifactId>

       <configuration>

         <check>

           <branchRate>85</branchRate>

           <lineRate>85</lineRate>

           <haltOnFailure>true</haltOnFailure>

           <totalBranchRate>85</totalBranchRate>

           <totalLineRate>85</totalLineRate>

           <packageLineRate>85</packageLineRate>

           <packageBranchRate>85</packageBranchRate>

           <regexes>         

             <regex>

               <pattern>com.example.boringcode.*</pattern>

               <branchRate>40</branchRate>

               <lineRate>30</lineRate>

             </regex>

           </regexes>

         </check>

       </configuration>

       <executions>

         <execution>

           <goals>

             <goal>clean</goal>

             <goal>check</goal>

           </goals>

         </execution>

       </executions>

     </plugin>

     

  

     <plugin>

       <groupId>org.apache.maven.plugins</groupId>

       <artifactId>maven-pmd-plugin</artifactId>

       <version>2.3</version>

     </plugin>

 

         <plugin>

       <groupId>org.apache.maven.plugins</groupId>

       <artifactId>maven-checkstyle-plugin</artifactId>

       <configuration>

         <enableRulesSummary>false</enableRulesSummary>

        </configuration>

     </plugin>

 

 

   </plugins>

 </build>

 

 <reporting>

    <plugins>

    

         <plugin>

       <groupId>org.apache.maven.plugins</groupId>

       <artifactId>maven-project-info-reports-plugin</artifactId>

       <version>2.0.1</version>

     </plugin>

     

    

     <plugin>

       <groupId>org.codehaus.mojo</groupId>

       <artifactId>cobertura-maven-plugin</artifactId>

     </plugin>

         

    <plugin>

       <groupId>org.apache.maven.plugins</groupId>

       <artifactId>maven-pmd-plugin</artifactId>

       <version>2.3</version>

       <configuration>

         <linkXref>true</linkXref>

         <sourceEncoding>utf-8</sourceEncoding>

         <minimumTokens>100</minimumTokens>

         <targetJdk>1.5</targetJdk>

         <excludes>

           <exclude>**/*Bean.java</exclude>

           <exclude>**/generated/*.java</exclude>

         </excludes>

         <excludeRoots>

           <excludeRoot>target/generated-sources/stubs</excludeRoot>

         </excludeRoots>

       </configuration>

     </plugin>

  

     <plugin>

       <groupId>org.apache.maven.plugins</groupId>

       <artifactId>maven-checkstyle-plugin</artifactId>

     </plugin>

 

                   <plugin>

       <groupId>org.codehaus.mojo</groupId>

       <artifactId>findbugs-maven-plugin</artifactId>

       <version>2.0</version>

       <configuration>

         <effort>Max</effort>

         <threshold>Low</threshold>

          <findbugsXmlOutput>true</findbugsXmlOutput>

         <!-- Optional directory to put findbugs xml report -->

         <findbugsXmlOutputDirectory>target</findbugsXmlOutputDirectory>

 

         <!--

         <includeFilterFile>lib-filter.xml</includeFilterFile>

         -->

       </configuration>

     </plugin> 

   </plugins>

 </reporting>

 

</project>

  

然后maven编译生成site报告: D:\project\mvn-examples-1.0\ch05-simple-web\simple-webapp>mvn clean -Dmaven.compile.debug site   jetty:run         

报告在: D:\project\mvn-examples-1.0\ch05-simple-web\simple-webapp\target\site\cobertura

 

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2018-11-16  
    123
45678910
11121314151617
18192021222324
252627282930 

数据统计

  • 访问量: 249593
  • 日志数: 186
  • 图片数: 1
  • 建立时间: 2007-03-16
  • 更新时间: 2017-12-06

RSS订阅

Open Toolbar