Java failed to read class file

Challenges are what make life interesting

Exception in thread «main» java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:

file:/C:/Users/User1/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar
try deleting this jar file and run your app and keep a backup of this jar file.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

gradle build failed with » failed to read class file» exception when working with JDK 11 #7059

gradle build failed with » failed to read class file» exception when working with JDK 11 #7059

Comments

Expected Behavior

./gradlew build should run the junit cases.

Читайте также:  Java create swing window

Current Behavior

But exactly the test task failed. Here is the output

Execution failed for task ':test'. > failed to read class file /Users/vincent/Lmwork/lmcodes/sitemonitor/build/classes/java/test/com/*** 

And here is the exception when running with —stacktrace:

 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:801) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99) . 31 more Caused by: java.lang.UnsupportedOperationException at org.objectweb.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248) at org.objectweb.asm.ClassReader.accept(ClassReader.java:651) at org.objectweb.asm.ClassReader.accept(ClassReader.java:391) at org.gradle.api.internal.tasks.testing.detection.AbstractTestFrameworkDetector.classVisitor(AbstractTestFrameworkDetector.java:124) . 67 more 

Here is the gradle version:

------------------------------------------------------------ Gradle 4.10.2 ------------------------------------------------------------ Build time: 2018-09-19 18:10:15 UTC Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd Kotlin DSL: 1.0-rc-6 Kotlin: 1.2.61 Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018 JVM: 11 (Oracle Corporation 11+28) OS: Mac OS X 10.12.6 x86_64 

And Notice, If I change the sourceCompatibility to JDK10, gradle build can pass. But when it is set to JavaVersion.VERSION_11, it fails.

Context

This confused us when we are trying to upgrading JDK to 11.

Steps to Reproduce (for bugs)

Add a test case in your gradle project with following code:

import org.junit.Assert; import org.junit.Test; public class TestHello < @Test public void testHello() < Runnable r = new Runnable() < @Override public void run() < >>; > > 

And Make sure the sourceCompatibility is set JavaVersion.VERSION_11 in the build.gradle file:

sourceCompatibility = JavaVersion.VERSION_11 

Your Environment

------------------------------------------------------------ Gradle 4.10.2 ------------------------------------------------------------ Build time: 2018-09-19 18:10:15 UTC Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd Kotlin DSL: 1.0-rc-6 Kotlin: 1.2.61 Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018 JVM: 11 (Oracle Corporation 11+28) OS: Mac OS X 10.12.6 x86_64 

The text was updated successfully, but these errors were encountered:

Источник

Оцените статью