Running with JaCoCo fails Spring boot integration test

56 views
Skip to first unread message

Echo Xu

unread,
Feb 4, 2020, 4:17:18 PM2/4/20
to JaCoCo and EclEmma Users

Hi,

I ran into this issue https://github.com/jacoco/jacoco/issues/168 when integrate JaCoCo to our spring boot project. The error is as below:

{code}
org.springframework.beans.NotReadablePropertyException: Invalid property '$jacocoData' of bean class [com.model.AssetType]: Bean property '$jacocoData' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:622)
at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:612)
at com.base.repository.BaseInfoMongoRepository.updateByOrganizationIdAndId(BaseInfoMongoRepository.java:37)
at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
{code}

I know this is because JaCoCo instrumented the AssetType class and added some methods to it and Spring reflection logic fails due to that. I tried exclude the class AssetType from being instrumented via however it when running the integration test (which will use this class), it still gets the same error, my question is why AssetType is not excluded for instrumentation in this case? 

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.2</version>
    <configuration>
        <exclude>com/model/AssetType.class</exclude>
    </configuration>
    ....
</plugin>


Thanks,
Echo

Marc Hoffmann

unread,
Feb 5, 2020, 3:37:43 PM2/5/20
to JaCoCo and EclEmma Users
Hi Echo,

the property is called “excludes” not "exclude”. Also for agent configuration the VM name is expected. Please try

        <excludes>
            <exclude>com/model/AssetType</exclude>
        </excludes>
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/169c5eb6-5304-4fd8-8a5d-0a28447ebd9b%40googlegroups.com.

Echo Xu

unread,
Feb 7, 2020, 11:22:22 AM2/7/20
to JaCoCo and EclEmma Users
Hi Marc,

Thanks a lot! it's the file path format (https://github.com/jacoco/jacoco/issues/34) that did the trick. (I have the "excludes" part but just missed to type it.)

For other's reference, working configuration:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.2</version>
    <configuration>
        <excludes>
             <exclude>com/model/AssetType</exclude>
        <excludes>
    </configuration>
    ....
</plugin>



Thank you,
Echo




To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages