Using the jarnotator maven plugin
Last Updated on Sunday, 05 September 2010 07:32 Written by jarnotator Saturday, 14 August 2010 09:28
Adding jarnotator to your maven builds is a straightforward process that takes less than 5 minutes. In this short document you'll see how to add the jarnotator plugin to your maven builds and have it analyze your bytecode after every successful compilation of your code.
Why use the maven plugin
Good reasons for using jarnotator's maven plugin:
- ease of integration into existing maven build
- automatic use of dependencies during analysis
- simple configuration
Adding the plugin to the build cycle
To add the jarnotator maven plugin to an existing maven build requires 2 simple steps:
- Point maven at the biggerbytes.be repository
- Add the plugin to the build section
Define the repositories
In this section we describe how you can quickly setup a standard maven build to included jarnotator plugin by defining the necessary repository from within the pom.xml. In a corporate setting you may be required to use repository manager. If this is the case please consult with the person in charge to add the necessary proxy configuration to access the biggerbytes.be repository.
IMPORTANT: the biggerytes.be repository is publicly accessible but not browsable. Please refer to the online information regarding the available versions.
The pom.xml needs to define 2 repositories. One for the jarnotator plugin itself and one for the core part of jarnotator. This means one pluginRepository entry and one repository entry. One simply needs to add:
<repositories>
<!-- Let your build still look at repo1 first -->
<repository>
<id>repo1</id>
<url>http://repo1.maven.org</url>
</repository>
<!-- jarnotator and its plugin are available in this repo -->
<repository>
<id>biggerbytes.be</id>
<url>http://www.biggerbytes.be/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<!-- Let your build still look at repo1 first -->
<pluginRepository>
<id>repo1</id>
<url>http://repo1.maven.org</url>
</pluginRepository>
<!-- jarnotator and its plugin are available in this repo -->
<pluginRepository>
<id>biggerbytes.be</id>
<url>http://www.biggerbytes.be/maven2</url>
</pluginRepository>
</pluginRepositories>
Once the necessary repositories are accessible to maven it will download both the plugin and it dependencies. If maven can not download the plugin or another artifact with the be.biggerbytes groupId please confirm the above settings are correctly set pom.xml. Check for possible security policies blocking access to certain site.
Add the plugin
In this section we illustrate the use of the plugin without the use of <pluginManagement>. Obviously the later is possible as well.
The jarnotator plugin comes with 2 goals: classes and jar. By default the classes goal of the jarnotator plugin is bound to the process-classes phase of the build. It must be activated by defining a execution. The second goal offered by the plugin is meant to process a jar file rather than a classes directory. This goal is not bound to any phase. It can be invoked on the command line like any other goal.
To get start just add the maven-jarnotator-plugin to the build plugin as illustrated below.
<build>
<plugins>
<plugin>
<groupId>be.biggerbytes.jarnotator</groupId>
<artifactId>maven-jarnotator-plugin</artifactId>
<version>free-1.2</version>
<executions>
<execution>
<goals> <goal>classes</goal> </goals> <configuration> <simpleDebug>true</simpleDebug> <processOlderJava>true</processOlderJava> </configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
All the jarnotator configuration options are available to the maven plugin.
Feed Display
| Linux Today |
| Linux Today News Service |
![]() |
|















