Using the Reporting Pom - novoda/public-mvn-repo GitHub Wiki
- Required Pom Changes for Existing Projects
- Setup new Jenkins Job
- Changes to Pom if you are not extending Novoda.Reporting.pom
Unfortunately you cannot simply transfer an existing Jenkins Maven build to a free-style build. You have to create new build. See SQLite Provider for a worked example.
- Change your parent to be the Novoda reporting pom
<parent>
<groupId>com.novoda</groupId>
<artifactId>reporting</artifactId>
<version>1.1.0</version>
</parent>
- Add this property if your package doesn’t start ‘com.novoda’ (req: FindBugs)
<properties>
<reporting.package.analyze>com.client.package.*</reporting.package.analyze>
</properties>
- Create the folder /team-props/ and add these properties files lint.xml, findbugs-exclude.xml, checkstyle.xml
Example can be found at Team Props Example
See SQLite Provider for worked example
If your project has more than one build indicate difference such as PROJECT_NAME - BRANCH_NAME
Max number of builds to 50 (it is nice to have history but space is precious)
- Provide project Repository URL example [email protected]:novoda/P2D2.git
- Click on Advanced button and in Branch Specifier enter name of branch, usually master (you can leave this field empty and by default on each Jenkins will try to run whole setup, however be aware if you break something in your personal branch everybody will know about it including clients if they have access to build which will be confusing for them as most of them are non-technical)
Select Build when a change is pushed to GitHub
- Choose Invoke top-level Maven Targets.
-
- In Maven Version select MVN3 and in Goals type: clean install
- Select Add build step, select Execute shell
mvn cobertura:cobertura;
mvn findbugs:findbugs;
mvn pmd:pmd;
mvn test;
mvn checkstyle:checkstyle;
lint --config team-props/lint.xml --xml lint-results.xml .;
-
Publish Android Lint results with Lint files **/lint-results.xml
-
Publish Checkstyle analysis results with Checkstyle results **/checkstyle-result.xml
-
Publish FindBugs analytics results with FindBugs results **/findbugsXml.xml
-
Publish PMD analysis results with PMD results **/pmd.xml
-
Publish Cobertura Coverage Reports with **/target/site/cobertura/coverage.xml
-
Add Sonar no extra settings required
-
Add the Continuous Integration game
-
Incase there are JUnit reports in app Publish JUnit test result report with app/target/surefire-reports/*.xml
-
E-mail Notification enter [email protected] and check
-
- Send e-mail for every unstable build
-
- Send separate e-mails to individuals who broke the build
See Reporting for worked example.
- Add Cobertura dependency
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>xml</format>
</formats>
<check/>
</configuration>
<executions>
<execution>
<phase>clean</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
- Add Cobertura
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</reporting>
- Add Checkstyle
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
</build>
- Add FindBugs
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<xmlOutput>true</xmlOutput>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
</plugins>
</reporting>
- Add PMD
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.7.1</version>
</plugin>
</plugins>
</reporting>
- Add Surefire
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/*Test*.java</include>
<include>**/*Should.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
- Set the properties
<properties>
<reporting.package.analyze>com.client.package.*</reporting.package.analyze>
<reporting.findbugs.exclude>team-props/findbugs-exclude.xml</reporting.findbugs.exclude>
<reporting.checkstyle.rules>team-props/checkstyle.xml</reporting.checkstyle.rules>
</properties>
- Create the folder /team-props/ and add these properties files lint.xml, findbugs-exclude.xml, checkstyle.xml
Example can be found at Team Props Example