DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
  • Alpha Testing Tutorial: A Comprehensive Guide With Best Practices
  • Designing a New Framework for Ephemeral Resources
  • How Agile Works at Tesla [Video]

Trending

  • Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
  • Alpha Testing Tutorial: A Comprehensive Guide With Best Practices
  • Designing a New Framework for Ephemeral Resources
  • How Agile Works at Tesla [Video]
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Trending Analysis With Maven Dashboard

Trending Analysis With Maven Dashboard

Walter Bogaardt user avatar by
Walter Bogaardt
·
Jun. 17, 09 · Interview
Like (2)
Save
Tweet
Share
9.84K Views

Join the DZone community and get the full member experience.

Join For Free

Continuous integration is talked about as part of Agile development practices. It is lauded for its use to keep developers from “breaking the build”. This tip will discuss how to implement trend reporting in daily builds using the Maven and the Maven-dashboard plug-in. Continuous integration or CI that should be looked at beyond the scope of constantly compiling checked-in code. It is one step in many, which should be part of a code review process.

Maven project builds lends itself well in facilitating builds and generating artifacts such as reports on code quality. These report plug-ins can track levels of unit tests and code coverage, how well code is following coding practices via checkstyles, or suboptimal code or duplication of code.

In the ideal world of software development, these reports would be reviewed daily as part of a code review process. The truth be told it doesn't always occur. Software engineers and their leads are humans with time constraints. Chalk it up to having attend the next time management course. The next best solution is at least identify trends of which way the code is progressing. Maven dashboard provides historical trending.

The Maven dashboard plug-in can store report statistics in a database and generate site reports with trends from prior daily and weekly builds. Since reports take time it is best that they are run once a day during off peak development hours. That is because they take up additional cycles in the continuous build process, which could lead to delivery time problems. At a minimum, report type builds should be done on a nightly basis to get trending benefits. There are a number of steps to follow to show trends in a generated site.

For the purpose of this sample, it is assumed an installation of the latest version of Maven 2.0, and JDK 1.4 or later. The last requirement is a persistence storage. MySql will be a good storage base for the application history. A basic understanding of Maven 2.0 project structure is also necessary. Kepping with the simple idea this demonstrates only a single project set-up. Listing 1. is a basic maven project. For demonstration purpose, the project will includes TestNG dependency.


Listing 1. Pom.xml project

<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.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.softlanding.dashboard</groupId>
<artifactId>example-dashboard</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Example dashboard with maven</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.1</version>
<classifier>jdk15</classifier>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<finalName>sampleprj</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<wtpversion>1.0</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dashboard-maven-plugin</artifactId>
<configuration>
<dialect>org.hibernate.dialect.MySQLInnoDBDialect</dialect>
<driverClass>com.mysql.jdbc.Driver</driverClass>
<connectionUrl>jdbc:mysql://localhost:3306/continuum?autoReconnect=true</connectionUrl>
<username>root</username>
<password>sn@pple</password>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>project-team</report>
<report>mailing-list</report>
<report>cim</report>
<report>issue-tracking</report>
<report>license</report>
<report>scm</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<targetJdk>${compilerTarget}</targetJdk>
<sourceEncoding>${fileEncoding}</sourceEncoding>
<excludes>
<exclude>${vm.report.exclusions}</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</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>
<configuration>
<xmlOutput>true</xmlOutput>
<effort>Max</effort>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dashboard-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

 

 
The dashboard-maven-plugin has configuration settings pointing to connections for the Mysql database. If the database doesn't have the tables already, it will be created the project. Also each project has it's own unique ID so there is no need for multiple database schemes for the x number of projects there might be in an organization.

Supposing you have a simple application and test ready to compile, there are three goals need to generate historical trends. The first is running mvn clean install site. This compiles and generates the maven project site. The second step is running mvn dashboard:persist. This goal will take the results of the reports and store them in the database. The third goal is to run mvn dasboard:dashboard. This re-generates the reports and aggregates the historical information from each report.

When setting up an integration environment due to the lifecycle of the maven dashboard each of those goals will have to be run in order to store and generate a historical report. The result historical report will be in the target/site/ directory of the maven project called “dashboard-report-historic.html” It will show daily and weekly trends for each report specified in the project to generate. There are further configuration customization that can be done to the dashboard report.

Newer application development can benefit greatly from using Maven as their build. It's not a perfect tool but it does go into the right direction for managing software projects. As developers strive not only to produce better code, they shouldn't let long term development and refactorings allow the code start looking like the next contestant of the Biggest Loser.

Apache Maven Dashboard (Mac OS) Continuous Integration/Deployment

Opinions expressed by DZone contributors are their own.

Trending

  • Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
  • Alpha Testing Tutorial: A Comprehensive Guide With Best Practices
  • Designing a New Framework for Ephemeral Resources
  • How Agile Works at Tesla [Video]

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: