Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build path issue : Unexpected "Incompatible .class files version in required binaries" #1806

Open
sbernard31 opened this issue Aug 14, 2024 · 1 comment

Comments

@sbernard31
Copy link

Hi,

I face a strange behavior when I try to build my Maven project with Eclipse, I get this error in Problems view :

Incompatible .class files version in required binaries. Project 'leshan-integration-tests' is targeting a 1.8 runtime, but is compiled against 'home/sbernard/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.1/junit-jupiter-engine-5.10.1.jar' (from the container 'Maven Dependencies') which requires a 9 runtime

but Junit5 should works with java 8 : https://junit.org/junit5/docs/current/user-guide/#overview-java-versions

When I build with maven I have not issue.

If I delete all this Error in eclipse and try to rebuild it works but sometime the error comeback which break the automatic build then I need to delete the error again .... 😬

Any idea why I face this behavior ?

I try to look at junit-jupiter-engine-5.10.1 pom an see nothing special about java 9 ...

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>junit-jupiter-engine</artifactId>
  <version>5.10.1</version>
  <name>JUnit Jupiter Engine</name>
  <description>Module "junit-jupiter-engine" of JUnit 5.</description>
  <url>https://junit.org/junit5/</url>
  <licenses>
    <license>
      <name>Eclipse Public License v2.0</name>
      <url>https://www.eclipse.org/legal/epl-v20.html</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>bechte</id>
      <name>Stefan Bechtold</name>
      <email>stefan.bechtold@me.com</email>
    </developer>
    <developer>
      <id>jlink</id>
      <name>Johannes Link</name>
      <email>business@johanneslink.net</email>
    </developer>
    <developer>
      <id>marcphilipp</id>
      <name>Marc Philipp</name>
      <email>mail@marcphilipp.de</email>
    </developer>
    <developer>
      <id>mmerdes</id>
      <name>Matthias Merdes</name>
      <email>matthias.merdes@heidelpay.com</email>
    </developer>
    <developer>
      <id>sbrannen</id>
      <name>Sam Brannen</name>
      <email>sam@sambrannen.com</email>
    </developer>
    <developer>
      <id>sormuras</id>
      <name>Christian Stein</name>
      <email>sormuras@gmail.com</email>
    </developer>
    <developer>
      <id>juliette-derancourt</id>
      <name>Juliette de Rancourt</name>
      <email>derancourt.juliette@gmail.com</email>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/junit-team/junit5.git</connection>
    <developerConnection>scm:git:git://github.com/junit-team/junit5.git</developerConnection>
    <url>https://github.com/junit-team/junit5</url>
  </scm>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>5.10.1</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-engine</artifactId>
      <version>1.10.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.10.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apiguardian</groupId>
      <artifactId>apiguardian-api</artifactId>
      <version>1.1.2</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

Version used :

M2E - Maven Integration for Eclipse 2.4.200.20231002-0712 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e
M2E - POM Editor using LemMinX language server (includes Incubating components) 2.0.5.20230815-1219 org.eclipse.m2e.lemminx.feature.feature.group Eclipse.org - m2e
M2E - SLF4J over Logback Logging 2.2.0.20230819-1220 org.eclipse.m2e.logback.feature.feature.group Eclipse.org - m2e

Eclipse IDE for Java Developers (includes Incubating components)
Version: 2023-09 (4.29.0)
Build id: 20230907-1323

Linux 6.1.0-23-amd64 Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux

@ivenhov
Copy link

ivenhov commented Sep 11, 2024

Just wanted to mentioned I stumbled upon something like this with bytebuddy v 1.12.10 or newer with Java project set up to use Java 8.
Problem disappears when project's Setting->Java Compiler->Building->Incompatible required binaries is changed from Error to Warning
See details here
raphw/byte-buddy#1688

Is there a module-info.class inspection happening on projects with Java 8 ?

Also related
junit-team/junit5#3619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants