Coder Social home page Coder Social logo

aspectj-with-clover-instr's Introduction

Performing code instrumentation with Clover (OpenClover) and AspectJ

Clover is a code coverage tool originally owned by Atlassian and afterwards open-sourced. AspectJ is a framework for Aspect-Oriented Programming. Both of these frameworks mess up with the source code (or compiled code), and from what I experience this can be troublesome. The following lists how we can make these work without any problems and provides three alternative ways for changing your plugins to achieve this same goal:

  1. maven-compiler-plugin must not try to recompile already compiled code from aspectj-maven-plugin, therefore AspectJ compiler goals are run in process-sources phase;

  2. Both OpenClover and AspectJ add source code to each method, and therefore AspectJ may raise an unexpected code error. In order for this to work, one of three methods may be implemented:

    1. Inline all @Pointcut definitions so that OpenClover doesn't add any coverage code to an empty method body;
    2. Aspect files can be excluded from code coverage using <exclude>..</exclude> configuration in clover-maven-plugin. This is the solution adopted in this example;
    3. Aspect files can also be renamed from *.java to *.aj, making OpenClover simply ignore the latter. This is the easiest solution;

Also, original StackOverflow question: https://stackoverflow.com/questions/50744732/openclover-getting-to-work-with-aspectj

aspectj-with-clover-instr's People

Contributors

nunomarks avatar kriegaex avatar

Watchers

 avatar

Forkers

kriegaex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.