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.

An API incompatibility was encountered while executing net.alchim31.maven:scala-maven-plugin:4.0.1

See original GitHub issue

Hello There

Were using

 <scala.version>2.12</scala.version>
 <scala.minor.version>2.12.0</scala.minor.version>

Maven

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T19:41:47+01:00)
Maven home: /home/xyz/tools/maven/apache-maven-3.6.0
**Java version: 1.8.0_212, vendor: Eclipse OpenJ9, runtime: /home/xyz/tools/java/jdk8u212-b03/jre**
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-18-generic", arch: "amd64", family: "unix"

and have

<dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.minor.version}</version>
            <scope>compile</scope>
        </dependency>

and

<plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>4.0.1</version>
                <executions>
                    <!--https://github.com/davidB/scala-maven-plugin/issues/234-->
                        <execution>
                            <id>scala-compile-first</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>add-source</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

and maven compiler

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

but a simple mvn clean compile results in

ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:4.0.1:compile (scala-compile-first) on project client: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:4.0.1:compile failed: An API incompatibility was encountered while executing net.alchim31.maven:scala-maven-plugin:4.0.1:compile: java.lang.IncompatibleClassChangeError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>net.alchim31.maven:scala-maven-plugin:4.0.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/xyz/.m2/repository/net/alchim31/maven/scala-maven-plugin/4.0.1/scala-maven-plugin-4.0.1.jar
[ERROR] urls[1] = file:/home/xyz/.m2/repository/org/apache/maven/maven-builder-support/3.3.9/maven-builder-support-3.3.9.jar
[ERROR] urls[2] = file:/home/xyz/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
[ERROR] urls[3] = file:/home/xyz/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
[ERROR] urls[4] = file:/home/xyz/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[5] = file:/home/xyz/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar
[ERROR] urls[6] = file:/home/xyz/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
[ERROR] urls[7] = file:/home/xyz/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar
[ERROR] urls[8] = file:/home/xyz/.m2/repository/org/eclipse/aether/aether-util/1.0.2.v20150114/aether-util-1.0.2.v20150114.jar
[ERROR] urls[9] = file:/home/xyz/.m2/repository/com/google/inject/guice/4.0/guice-4.0-no_aop.jar
[ERROR] urls[10] = file:/home/xyz/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[11] = file:/home/xyz/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[12] = file:/home/xyz/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[13] = file:/home/xyz/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[14] = file:/home/xyz/.m2/repository/org/apache/maven/shared/maven-dependency-tree/3.0.1/maven-dependency-tree-3.0.1.jar
[ERROR] urls[15] = file:/home/xyz/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar
[ERROR] urls[16] = file:/home/xyz/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.1/plexus-utils-3.1.1.jar
[ERROR] urls[17] = file:/home/xyz/.m2/repository/org/codehaus/plexus/plexus-archiver/4.1.0/plexus-archiver-4.1.0.jar
[ERROR] urls[18] = file:/home/xyz/.m2/repository/org/codehaus/plexus/plexus-io/3.1.1/plexus-io-3.1.1.jar
[ERROR] urls[19] = file:/home/xyz/.m2/repository/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
[ERROR] urls[20] = file:/home/xyz/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
[ERROR] urls[21] = file:/home/xyz/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar
[ERROR] urls[22] = file:/home/xyz/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[23] = file:/home/xyz/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[24] = file:/home/xyz/.m2/repository/org/apache/maven/maven-archiver/3.4.0/maven-archiver-3.4.0.jar
[ERROR] urls[25] = file:/home/xyz/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
[ERROR] urls[26] = file:/home/xyz/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[27] = file:/home/xyz/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.8/doxia-sink-api-1.8.jar
[ERROR] urls[28] = file:/home/xyz/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.8/doxia-logging-api-1.8.jar
[ERROR] urls[29] = file:/home/xyz/.m2/repository/org/apache/maven/shared/maven-invoker/3.0.1/maven-invoker-3.0.1.jar
[ERROR] urls[30] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc_2.12/1.2.5/zinc_2.12-1.2.5.jar
[ERROR] urls[31] = file:/home/xyz/.m2/repository/org/scala-lang/scala-library/2.12.6/scala-library-2.12.6.jar
[ERROR] urls[32] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-core_2.12/1.2.5/zinc-core_2.12-1.2.5.jar
[ERROR] urls[33] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-apiinfo_2.12/1.2.5/zinc-apiinfo_2.12-1.2.5.jar
[ERROR] urls[34] = file:/home/xyz/.m2/repository/org/scala-sbt/compiler-bridge_2.12/1.2.5/compiler-bridge_2.12-1.2.5.jar
[ERROR] urls[35] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-classpath_2.12/1.2.5/zinc-classpath_2.12-1.2.5.jar
[ERROR] urls[36] = file:/home/xyz/.m2/repository/org/scala-lang/scala-compiler/2.12.6/scala-compiler-2.12.6.jar
[ERROR] urls[37] = file:/home/xyz/.m2/repository/org/scala-sbt/compiler-interface/1.2.5/compiler-interface-1.2.5.jar
[ERROR] urls[38] = file:/home/xyz/.m2/repository/org/scala-sbt/util-interface/1.2.2/util-interface-1.2.2.jar
[ERROR] urls[39] = file:/home/xyz/.m2/repository/org/scala-sbt/io_2.12/1.2.0/io_2.12-1.2.0.jar
[ERROR] urls[40] = file:/home/xyz/.m2/repository/com/swoval/apple-file-events/1.3.2/apple-file-events-1.3.2.jar
[ERROR] urls[41] = file:/home/xyz/.m2/repository/net/java/dev/jna/jna/4.5.0/jna-4.5.0.jar
[ERROR] urls[42] = file:/home/xyz/.m2/repository/net/java/dev/jna/jna-platform/4.5.0/jna-platform-4.5.0.jar
[ERROR] urls[43] = file:/home/xyz/.m2/repository/org/scala-sbt/util-logging_2.12/1.2.2/util-logging_2.12-1.2.2.jar
[ERROR] urls[44] = file:/home/xyz/.m2/repository/com/eed3si9n/sjson-new-core_2.12/0.8.2/sjson-new-core_2.12-0.8.2.jar
[ERROR] urls[45] = file:/home/xyz/.m2/repository/jline/jline/2.14.4/jline-2.14.4.jar
[ERROR] urls[46] = file:/home/xyz/.m2/repository/org/apache/logging/log4j/log4j-api/2.8.1/log4j-api-2.8.1.jar
[ERROR] urls[47] = file:/home/xyz/.m2/repository/org/apache/logging/log4j/log4j-core/2.8.1/log4j-core-2.8.1.jar
[ERROR] urls[48] = file:/home/xyz/.m2/repository/com/lmax/disruptor/3.3.6/disruptor-3.3.6.jar
[ERROR] urls[49] = file:/home/xyz/.m2/repository/com/eed3si9n/sjson-new-scalajson_2.12/0.8.2/sjson-new-scalajson_2.12-0.8.2.jar
[ERROR] urls[50] = file:/home/xyz/.m2/repository/com/eed3si9n/shaded-scalajson_2.12/1.0.0-M4/shaded-scalajson_2.12-1.0.0-M4.jar
[ERROR] urls[51] = file:/home/xyz/.m2/repository/org/spire-math/jawn-parser_2.12/0.10.4/jawn-parser_2.12-0.10.4.jar
[ERROR] urls[52] = file:/home/xyz/.m2/repository/org/scala-lang/scala-reflect/2.12.6/scala-reflect-2.12.6.jar
[ERROR] urls[53] = file:/home/xyz/.m2/repository/org/scala-sbt/util-relation_2.12/1.2.2/util-relation_2.12-1.2.2.jar
[ERROR] urls[54] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-persist_2.12/1.2.5/zinc-persist_2.12-1.2.5.jar
[ERROR] urls[55] = file:/home/xyz/.m2/repository/com/trueaccord/scalapb/scalapb-runtime_2.12/0.6.0/scalapb-runtime_2.12-0.6.0.jar
[ERROR] urls[56] = file:/home/xyz/.m2/repository/com/trueaccord/lenses/lenses_2.12/0.4.12/lenses_2.12-0.4.12.jar
[ERROR] urls[57] = file:/home/xyz/.m2/repository/com/lihaoyi/fastparse_2.12/0.4.2/fastparse_2.12-0.4.2.jar
[ERROR] urls[58] = file:/home/xyz/.m2/repository/com/lihaoyi/fastparse-utils_2.12/0.4.2/fastparse-utils_2.12-0.4.2.jar
[ERROR] urls[59] = file:/home/xyz/.m2/repository/com/lihaoyi/sourcecode_2.12/0.1.3/sourcecode_2.12-0.1.3.jar
[ERROR] urls[60] = file:/home/xyz/.m2/repository/com/google/protobuf/protobuf-java/3.3.1/protobuf-java-3.3.1.jar
[ERROR] urls[61] = file:/home/xyz/.m2/repository/org/scala-sbt/sbinary_2.12/0.5.0/sbinary_2.12-0.5.0.jar
[ERROR] urls[62] = file:/home/xyz/.m2/repository/org/scala-lang/modules/scala-xml_2.12/1.0.6/scala-xml_2.12-1.0.6.jar
[ERROR] urls[63] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-compile-core_2.12/1.2.5/zinc-compile-core_2.12-1.2.5.jar
[ERROR] urls[64] = file:/home/xyz/.m2/repository/org/scala-sbt/launcher-interface/1.0.0/launcher-interface-1.0.0.jar
[ERROR] urls[65] = file:/home/xyz/.m2/repository/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.5/scala-parser-combinators_2.12-1.0.5.jar
[ERROR] urls[66] = file:/home/xyz/.m2/repository/org/scala-sbt/util-control_2.12/1.2.2/util-control_2.12-1.2.2.jar
[ERROR] urls[67] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-classfile_2.12/1.2.5/zinc-classfile_2.12-1.2.5.jar
[ERROR] urls[68] = file:/home/xyz/.m2/repository/org/scala-sbt/zinc-ivy-integration_2.12/1.2.5/zinc-ivy-integration_2.12-1.2.5.jar
[ERROR] urls[69] = file:/home/xyz/.m2/repository/org/scala-sbt/librarymanagement-core_2.12/1.2.0/librarymanagement-core_2.12-1.2.0.jar
[ERROR] urls[70] = file:/home/xyz/.m2/repository/com/jcraft/jsch/0.1.54/jsch-0.1.54.jar
[ERROR] urls[71] = file:/home/xyz/.m2/repository/com/eed3si9n/gigahorse-okhttp_2.12/0.3.0/gigahorse-okhttp_2.12-0.3.0.jar
[ERROR] urls[72] = file:/home/xyz/.m2/repository/com/eed3si9n/gigahorse-core_2.12/0.3.0/gigahorse-core_2.12-0.3.0.jar
[ERROR] urls[73] = file:/home/xyz/.m2/repository/com/typesafe/ssl-config-core_2.12/0.2.2/ssl-config-core_2.12-0.2.2.jar
[ERROR] urls[74] = file:/home/xyz/.m2/repository/com/typesafe/config/1.2.0/config-1.2.0.jar
[ERROR] urls[75] = file:/home/xyz/.m2/repository/org/reactivestreams/reactive-streams/1.0.0/reactive-streams-1.0.0.jar
[ERROR] urls[76] = file:/home/xyz/.m2/repository/com/squareup/okhttp3/okhttp/3.7.0/okhttp-3.7.0.jar
[ERROR] urls[77] = file:/home/xyz/.m2/repository/com/squareup/okio/okio/1.12.0/okio-1.12.0.jar
[ERROR] urls[78] = file:/home/xyz/.m2/repository/com/squareup/okhttp3/okhttp-urlconnection/3.7.0/okhttp-urlconnection-3.7.0.jar
[ERROR] urls[79] = file:/home/xyz/.m2/repository/org/scala-sbt/util-position_2.12/1.2.0/util-position_2.12-1.2.0.jar
[ERROR] urls[80] = file:/home/xyz/.m2/repository/org/scala-sbt/util-cache_2.12/1.2.0/util-cache_2.12-1.2.0.jar
[ERROR] urls[81] = file:/home/xyz/.m2/repository/com/eed3si9n/sjson-new-murmurhash_2.12/0.8.2/sjson-new-murmurhash_2.12-0.8.2.jar
[ERROR] urls[82] = file:/home/xyz/.m2/repository/org/scala-lang/modules/scala-java8-compat_2.12/0.9.0/scala-java8-compat_2.12-0.9.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

and

Ubuntu 18.10 4.18.0-18-generic

Does this have to do with using adoptJDK https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=openj9?

Or is this some other bug? Happy to provide more info to help debug this.

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
davidBcommented, May 5, 2019

scala.version is used to define scala version (without need to define scala-library as a dependency) see http://davidb.github.io/scala-maven-plugin/compile-mojo.html#scalaVersion is is a full version major.minor.bugfix

scala.compat.version is the other property to used as part of the artifact’s name see http://davidb.github.io/scala-maven-plugin/compile-mojo.html#scalaCompatVersion

So you should rename

  • scala.version into scala.compat.version
  • scala.minor.version into scala.version
0reactions
abhi0642commented, Aug 1, 2022

While making a build for your project in any cloud environment. Try to change image from linux/unix to window or window to other. The operating system and image type should be the same to successfully build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

An API incompatibility was encountered while ... - Stack Overflow
After a lot of digging and trying to eliminate one-by-one the ResourceTransformers used by the maven-shade-plugin, I have found the culprit:.
Read more >
"An API incompatibility was encountered while executing org ...
You are using Exchange Maven Facade v3 and getting the error from the subject. This article explains the possible cause and its solution....
Read more >
Compile failed due to incompatible version between scala and ...
Compile failed due to incompatible version between scala and scala-maven- ... failed: An API incompatibility was encountered while executing ...
Read more >
An API incompatibility was encountered ... - Sonar Community
Steps taken: Go to project folder (project is built in maven); Execute mvn sonar:sonar etc specified command followed on SonarQube.
Read more >
Integration Testing With Spring Cloud Contract
... An API incompatibility was encountered while executing org.springframework.cloud:spring-cloud-contract-maven-plugin:3.1.0:generateStubs: ...
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