2

I have the following plugins configured in my maven build:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>2.6</version>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.4</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <!-- plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M3</version>
        </plugin -->

Everything appears to be working fine, tests are run, code coverage is consumed by Sonar.

If I uncomment the surefire plugin, Sonar does not consume the code coverage and I get a .dumpstream file with the below content. What is causing this, and how do I resolve it?

Created at 2019-11-13T19:35:46.185 WARNING: An illegal reflective access operation has occurred

Created at 2019-11-13T19:35:46.193 WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector

(file:/C:/Users/tgunter/.m2/repository/com/sun/xml/bind/jaxb-impl/2.3.0/jaxb-impl-2.3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)

Created at 2019-11-13T19:35:46.205 WARNING: Please consider reporting this to the maintainers of

com.sun.xml.bind.v2.runtime.reflect.opt.Injector

Created at 2019-11-13T19:35:46.212 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

Created at 2019-11-13T19:35:46.222 WARNING: All illegal access operations will be denied in a future release

Arlo Guthrie
  • 1,152
  • 3
  • 12
  • 28

1 Answers1

4

You can try adding the following to the Maven Surefire Plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M3</version>
    <configuration>
        <argLine>
            --illegal-access=permit
        </argLine>
    </configuration>
</plugin>

If you are running with JDK 11.

Welsh
  • 5,138
  • 3
  • 29
  • 43
  • This is my first time to touch this code, so I'm beginning to suspect that nobody ever took the time to migrate to JDK 11. I probably need to review every dependency for JDK 11 as per https://winterbe.com/posts/2018/08/29/migrate-maven-projects-to-java-11-jigsaw/ – Arlo Guthrie Nov 14 '19 at 16:11
  • If no one has bothered to go through the motion to confirm it is all working then switch back to a JDK 8 and it should all work just fine. – Welsh Nov 15 '19 at 00:49
  • 1
    Which version of JAXB is used? This issue was fixed several years ago so I suspect you've ended up transitively depending an old version. – Alan Bateman Nov 15 '19 at 13:24
  • 1
    The issue is that someone needed functionality provided by surefire 3.0.0-M3, but that version is built for java 11 and nobody had bothered to update to a compatible version of spring boot. I upgraded spring boot to 2.2.1.RELEASE and it resolved the issue. – Arlo Guthrie Nov 15 '19 at 16:33