We have a spring boot project. Once the JDK is upgraded from 8 to 11 , there are groovy test-scripts which are failing with below exception

java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class x.y.z.Class due to missing dependency javax/xml/bind/ValidationEventLocator at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1083) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1061) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) a

It is using gmaven plugin to compile the groovies in test script.

'''

<plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version></version>
                <configuration>
                    <source>1.8</source>
                    <providerSelection>2.0</providerSelection>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.gmaven.runtime</groupId>
                        <artifactId>gmaven-runtime-2.0</artifactId>
                        <version>1.4</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>2.3.8</version>
                    </dependency>
                </dependencies>
            </plugin>`

''' I already have jaxb dependency added in pom.xml

'''

<dependency>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                    <version>2.3.1</version>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <version>2.2.7</version>
                </dependency>

'''

0

There are 0 best solutions below