Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

clover instrumentation exclusion on maven

will zhang August 29, 2016

Hi,

I'm having following error while using clover on my project. It seems clover added lines into a supposed to be empty method. So I'm using this exclusion configuration to excluse all java source that are having "Aspect" in it's name. However, the exclusion seems not working. I can still see the error while compiling.

Any idea why?

I know commenting out on source file using "///CLOVER: OFF" can turn off instrumentation on certain method lines. However I have so many files that I need to add these lines in. So exclusion on file pattern would work better in this case.

Error messages from Maven:

[INFO] --- aspectj-maven-plugin:1.7:compile (default) @ internal-framework ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[ERROR] Pointcuts without an if() expression should have an empty method body
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/idempotency/service/IdempotencyAspect.java:52
private void executionOfIdempotentAnnotatedMethod(Idempotent idempotent) {try{__CLR4_1_1je1je1isgiwyie.R.inc(25129);


[WARNING] no match for this type name: com.vmware.nsx.management.container.dao.impl.GemFireTransactionHandler [Xlint:invalidAbsoluteTypeName]
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/container/aspects/TransactionAspectSupport.java:32
@Pointcut(value = " execution(* *(..))  && !within(com.vmware.nsx.management.container.dao.impl.GemFireTransactionHandler)")
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


[ERROR] Pointcuts without an if() expression should have an empty method body
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/container/aspects/TransactionAspectSupport.java:33
private void anyMethodOutsideThisAspect() {try{__CLR4_1_1fbffbfisgiww3n.R.inc(19853);

[ERROR] Pointcuts without an if() expression should have an empty method body
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/container/aspects/TransactionAspectSupport.java:43
private void executionOfAnyPublicMethodTransactionalType() {try{__CLR4_1_1fbffbfisgiww3n.R.inc(19854);

[ERROR] Pointcuts without an if() expression should have an empty method body
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/container/aspects/TransactionAspectSupport.java:51
private void executionOfTransactionalMethod() {try{__CLR4_1_1fbffbfisgiww3n.R.inc(19855);

[ERROR] Pointcuts without an if() expression should have an empty method body
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/container/aspects/TransactionAspectSupport.java:62
protected void transactionalMethodExecution(Object txObject) {try{__CLR4_1_1fbffbfisgiww3n.R.inc(19856);

[ERROR] Pointcuts without an if() expression should have an empty method body
           /home/willz/git/nsx/mp/proton/internal-framework/target/clover/src-instrumented/com/vmware/nsx/management/container/aspects/TransactionalCheckerAspect.java:24
public void annotatedWithTransactional() {try{__CLR4_1_1fblfblisgiww44.R.inc(19857);

 

Pom.xml:

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>clover-maven-plugin</artifactId>
    <version>4.1.1</version>
    <configuration>
    ...
    <excludes>
        <exclude>**/*test/java</exclude>
        <exclude>**/*Test.groovy</exclude>
        <exclude>**/*Aspect.java</exclude>
        <exclude>**/*Aspect*.java</exclude>
        <exclude>**/TransactionalCheckerAspect.java</exclude>
    </excludes>
</configuration>

1 answer

1 vote
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 29, 2016

Hi Will,

Unfortunately using ///CLOVER:OFF and ///CLOVER:ON is the only way to disable Clover instrumentation on methods.

The methodContexts filter, which is based on method's signature, will not work in this case, because it does not stop instrumenting the method (the method context filter adds a special marker in Clover's database, so that such method can be later excluded in reports). 

Alternatively, you could experiment with the Clover AspectJ Compiler plugin - https://confluence.atlassian.com/display/CLOVER/Clover+AspectJ+Compiler - keep in mind however, that this plugin is not officially supported.

 

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 29, 2016

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events