Eclipse compiler raises NoClassDefFoundError for spring-boot-configuration-processor's ConfigurationMetadata class
Hello,
I'm using 2018.1 edition. I want to use "Eclipse" compiler in my project instead of the default "Javac" (to utilize the "Proceed on errors" feature).
I configured the following options:
- Compiler > Java compiler: Use compiler = Eclipse
- Compiler > Annotation processor: enabled
- SDK: jdk1.8
My project is a spring-boot apps which has spring-boot-annotation-processor in classpath. But when building the project, I got the following error
Error:java: Internal compiler error: java.lang.Exception: java.lang.NoClassDefFoundError: org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:169)
But if I switched to Javac compiler, all went well.
If I downloaded the ECJ-4.7.2 JAR from eclipse, combined the content of spring-boot-configuration-processor-1.5.9.RELEASE.jar into the ECJ jar, told intellij to use my custom ECJ jar. Then all went well.
I guess there's something wrong with the build classpath when intellij invokes ecj.jar
How can I fix this error?
Thanks,
Bao.
I have created a very simple project to demonstrate this issue:
pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>intellij.test</groupId>
<artifactId>test-ecj</artifactId>
<version>0.1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/>
</parent>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<graphql.spring-boot.version>3.9.2</graphql.spring-boot.version>
<spring-boot.version>1.5.9.RELEASE</spring-boot.version>
</properties>
<dependencies>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>${graphql.spring-boot.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphiql-spring-boot-starter</artifactId>
<version>${graphql.spring-boot.version}</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
An empty java file:
package intellij.test.ecj;
public class TestEcj {
}
The compiler configuration (file: .idea/compiler.xml)
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Eclipse" />
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="test-ecj" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="test-ecj" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>
Please sign in to leave a comment.
Please file a bug at https://youtrack.jetbrains.com/issues/IDEA. Attach a sample project to reproduce there.
It's created: https://youtrack.jetbrains.com/issue/IDEA-189760
I've noticed same problem. When I launch "Build Project" I've got compilation errors (in editor everything is fine, no errors), but when I choose "Rebuild Project" from menu, compilation ends with success.
I have a suspicion that the problem appeared during the change ecj version from 4.6.x to 4.7.
Unfortunately this is the problem in the ecj code. Please check out the explanation in the IDEA-189760 issue.
Still a problem