question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incremental recompileMode - java.lang.NoClassDefFoundError: java/sql/ResultSetMetaData

See original GitHub issue

Hi!

Thanks a lot for this plugin, I have enjoyed using it to build Java/Scala interop projects but I am observing few issues using it with default recompileMode incremental

To be more specific, build constantly fails both on the local machine and in CI environment for one rather large project with

2021-08-16 06:36:27.856 [inf] java.lang.NoClassDefFoundError: java/sql/ResultSetMetaData
2021-08-16 06:36:27.856 [inf] java.base/java.lang.Class.getDeclaredMethods0(Native Method)
2021-08-16 06:36:27.856 [inf] java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
2021-08-16 06:36:27.856 [inf] java.base/java.lang.Class.privateGetPublicMethods(Class.java:3191)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:499)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:399)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.Incremental$.apply(Incremental.scala:166)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
2021-08-16 06:36:27.859 [inf] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
2021-08-16 06:36:27.859 [inf] sbt_inc.SbtIncrementalCompiler.compile(SbtIncrementalCompiler.java:179)
2021-08-16 06:36:27.859 [inf] scala_maven.ScalaCompilerSupport.incrementalCompile(ScalaCompilerSupport.java:361)
2021-08-16 06:36:27.859 [inf] scala_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:118)
2021-08-16 06:36:27.859 [inf] scala_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:88)
2021-08-16 06:36:27.859 [inf] scala_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:305)
2021-08-16 06:36:27.859 [inf] org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
2021-08-16 06:36:27.859 [inf] org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
2021-08-16 06:36:27.859 [inf] org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
2021-08-16 06:36:27.859 [inf] org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
2021-08-16 06:36:27.859 [inf] org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
2021-08-16 06:36:27.859 [inf] org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:190)
2021-08-16 06:36:27.859 [inf] org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186)
2021-08-16 06:36:27.859 [inf] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2021-08-16 06:36:27.859 [inf] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
2021-08-16 06:36:27.859 [inf] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2021-08-16 06:36:27.859 [inf] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2021-08-16 06:36:27.859 [inf] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2021-08-16 06:36:27.859 [inf] java.base/java.lang.Thread.run(Thread.java:829)
2021-08-16 06:36:27.859 [inf]            
2021-08-16 06:36:44.060 [inf] [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:4.5.3:compile (default) on project app-service-impl_2.13: Execution default of goal net.alchim31.maven:scala-maven-plugin:4.5.3:compile failed.: CompileFailed -> [Help 1]
2021-08-16 06:36:44.068 [inf] [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:4.5.3:compile (default) on project app-db-impl_2.13: Execution default of goal net.alchim31.maven:scala-maven-plugin:4.5.3:compile failed: A required class was missing while executing net.alchim31.maven:scala-maven-plugin:4.5.3:compile: java/sql/ResultSetMetaData
2021-08-16 06:36:44.070 [inf] [ERROR] -----------------------------------------------------
2021-08-16 06:36:44.071 [inf] [ERROR] realm =    plugin>net.alchim31.maven:scala-maven-plugin:4.5.3
2021-08-16 06:36:44.073 [inf] [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
2021-08-16 06:36:44.077 [inf] [ERROR] urls[0] = file:/root/.m2/repository/net/alchim31/maven/scala-maven-plugin/4.5.3/scala-maven-plugin-4.5.3.jar
2021-08-16 06:36:44.080 [inf] [ERROR] urls[1] = file:/root/.m2/repository/org/apache/maven/maven-builder-support/3.3.9/maven-builder-support-3.3.9.jar
2021-08-16 06:36:44.083 [inf] [ERROR] urls[2] = file:/root/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
2021-08-16 06:36:44.084 [inf] [ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
2021-08-16 06:36:44.085 [inf] [ERROR] urls[4] = file:/root/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
2021-08-16 06:36:44.086 [inf] [ERROR] urls[5] = file:/root/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar
2021-08-16 06:36:44.086 [inf] [ERROR] urls[6] = file:/root/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
2021-08-16 06:36:44.087 [inf] [ERROR] urls[7] = file:/root/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar
2021-08-16 06:36:44.088 [inf] [ERROR] urls[8] = file:/root/.m2/repository/org/eclipse/aether/aether-util/1.0.2.v20150114/aether-util-1.0.2.v20150114.jar
2021-08-16 06:36:44.088 [inf] [ERROR] urls[9] = file:/root/.m2/repository/com/google/inject/guice/4.0/guice-4.0-no_aop.jar
2021-08-16 06:36:44.088 [inf] [ERROR] urls[10] = file:/root/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
2021-08-16 06:36:44.091 [inf] [ERROR] urls[11] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
2021-08-16 06:36:44.091 [inf] [ERROR] urls[12] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar

Following specs are used to compile and build project:

  • JVM version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
  • Scala version - 2.13.6
  • Scala-maven-plugin - 4.5.3
  • Scalac flags:
  <arg>-deprecation</arg>
                        <arg>-encoding</arg>
                        <arg>UTF-8</arg>
                        <arg>-explaintypes</arg>
                        <arg>-feature</arg>
                        <arg>-language:existentials</arg>
                        <arg>-language:higherKinds</arg>
                        <arg>-language:implicitConversions</arg>
                        <arg>-unchecked</arg>
                        <arg>-Wdead-code</arg>
                        <arg>-Werror</arg>
                        <arg>-Wnumeric-widen</arg>
                        <arg>-Wunused:implicits</arg>
                        <arg>-Wunused:imports</arg>
                        <arg>-Wunused:linted</arg>
                        <arg>-Wunused:locals</arg>
                        <arg>-Wunused:params</arg>
                        <arg>-Wunused:patvars</arg>
                        <arg>-Wunused:privates</arg>
                        <arg>-Wvalue-discard</arg>
                        <arg>-Xcheckinit</arg>
                        <arg>-Xlint</arg>
                        <arg>-Xsource:3</arg>
  • Compiler plugins:
  <compilerPlugins>
                        <compilerPlugin>
                            <groupId>org.typelevel</groupId>
                            <artifactId>kind-projector_2.13.6</artifactId>
                            <version>0.13.0</version>
                        </compilerPlugin>
                        <compilerPlugin>
                            <groupId>com.olegpy</groupId>
                            <artifactId>better-monadic-for_2.13</artifactId>
                            <version>0.3.1</version>
                        </compilerPlugin>
                    </compilerPlugins>
                    <jvmArgs>
                        <jvmArg>-Xss8m</jvmArg>
                        <jvmArg>-Xmx4096m</jvmArg>
                    </jvmArgs>

Switching back to recompileMode all would fix this issue I am seeing above but I would be very thankful if you could be so kind as to elaborate if there is any other workaround to address this issue.

Kind regards, Pavel

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
slandellecommented, Jun 1, 2022

30 changed files with 982 additions and 686 deletions

😭

1reaction
LeUser111commented, Jun 3, 2022

Version 4.6.2 works like a charm - thank you very much 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incremental recompileMode - java.lang. ...
NoClassDefFoundError : java/sql/ResultSetMetaData. ... interop projects but I am observing few issues using it with default recompileMode incremental.
Read more >
scala-maven-plugin
Incremental recompileMode - java.lang. ... NoClassDefFoundError: java/sql/ResultSetMetaData 2021-08-16 06:36:27.856 [inf] java.base/java.lang.Class.
Read more >
java.lang.NoClassDefFoundError: xsbt/CachedCompiler0$ ...
I'm getting the following error while compiling my integration tests. Interestingly this happens on Gitlab CI only, never locally.
Read more >
Incremental Compile - scala-maven-plugin
The incremental compilation is enabled by default after scala-maven-plugin v4.0.0, and the "recompileMode" configuration option is set to ...
Read more >
Scala Incremental compile fails with java.lang. ...
I have a multi project build. Here is the scala related bits in my parent script: subprojects { tasks.withType(ScalaCompile) { scalaCompileOptions.useAnt = ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found