This plugin is not supported by Atlassian.
Installation
Download the following binaries:
- Clover JAR (the org.openclover:clover Maven artifact)
- Clover AspectJ Compiler JAR (the org.openclover:clover-aspectj-compiler Maven artifact)
- AspectJ Runtime JAR (the org.aspectj:aspectjrt Maven artifact)
- AspectJ Tools JAR (the org.aspectj:aspectjrtools Maven artifact)
This integration was tested against AspectJ 1.8.9.
Usage
Compile the code with Clover
Clover AspectJ Compiler (CloverAJC) is a wrapper over the AspectJ Compiler (AJC) command line tool. You can pass any standard ajc parameters as well as additional options exclusive for Clover, such as:
- --initstring <path/to/clover.db> - location of the Clover database (default is ".clover/clover.db")
- --instrlevel (method/statement) - detail level of instrumentation (default is "statement")
- --encoding <charset> - character encoding used (uses a system encoding by default)
To run the CloverAJC:
- declare Clover, Clover AspectJ Compiler and AspectJ on the class path
- run com.atlassian.clover.instr.aspectj.CloverAjc class
- pass any options required by ajc - typically a list of files to be compiled and output directory
- optionally pass Clover-related options
Example:
java -cp "clover.jar:clover-aspectj-compiler.jar:aspectjrt.jar:aspectjtools.jar" com.atlassian.clover.instr.aspectj.CloverAjc -d <output directory> <list of files>
Run the code
Run the code as usual. Just ensure that Clover JAR is present in the class path.
While running the code, Clover will write coverage recording files to the folder where Clover database was created during compilation.
Generate coverage reports
You can use any Clover integration to generate reports (Ant, Maven etc). One of the easiest ways is to use the HtmlReporter command line tool, for example:
java -cp "clover.jar" com.atlassian.clover.reporters.html.HtmlReporter -i .clover/clover.db -o target/report -a -e
Source code
Repository
This plugin is open source. You can clone the repository from GitHub, e.g:
git clone https://github.com/openclover/clover-aspectj-compiler.git
Feel free to contribute!
Examples
In the src/test/resources folder you will find a sample project with an Ant build.xml script.
Troubleshooting
You can ask questions on Atlassian Community.
You can report bugs and feature requests in the issue tracker.