Maven Clirr plugin example : maven2 plugins

maven clirr plugin  from org.codehaus.mojo:-
Maven Clirr  plugin is used to give the report of your current project by comparing with other same old project.Basically if we configured this plugin to your project, it checks your project jar with an older version jar that is configured in pom.xml to compare.This plugin is to compare the source code as well as jar comparisions for incompatable issues to find in early stage of any module before releasing the module.


Why maven clirr is important before maven release:- 
 if you are releasing any maven module, that module should be well worked with backward combatble with modules that uses it. Once module is released. that module is used by different developers of different teams, if you find any issues after release, then we have to fix that issue rerelasing is the tedious task. To avoid this, It is always good idea  to use clirr plugin execution checks against previous version to verify compatability before releasing any your project module. This will specify any binarly combatable issues with the previous code.
Adding this plugin is stright forward in pom.xml. we have to add this plugin element in pluginManagement section of your project's pom.xml. This is same process for any new plugin to add to your project.

<pluginmanagement>
  <plugins>
    <plugin>
         <groupid>org.codehaus.mojo</groupid>
         <artifactid>clirr-maven-plugin</artifactid>
     </plugin>
  </plugins>
</pluginmanagement>
org.codehaus.mojo is providing the plugin to maven repository. Once this plugin is configured,clirr-maven-plugin is downloaed into your local repository.


Maven Clirr plugin reporting:- Once you configured the clirr plugin, you have to generate the reports for the combatable issues.
This reports shows the list of all errors and warnings with detailed messages messages
<reporting>
  <plugins>
    <plugin>
      <groupid>org.codehaus.mojo</groupid>
      <artifactid>clirr-maven-plugin</artifactid>
      <version>2.2.2</version>
      <configuration>
        <comparisonversion>1.1</comparisonversion>
      </configuration>
  </plugin>
 </plugins>
</reporting>
if your current project version is 1.2, you need to check with oldest project jar (1.1), then you have to define that version in comparisonVersion element in the reporting section.

How to generate the Clirr report?
Once plugin configuration and reporting configuraiton is configured in pom.xml, we have to run maven site command to generate the report.
maven site
By running this on command prompt, This will generate a clirr html report under the target/site directory with clirr-report.html
Alternatively you can also run mvn clirr:clirr to generate the report .
mvn clirr:clirr

Hope you understand the basics of maven clirr plugin with examples.

Please feel to share your comments on this.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.