Maven compilation issue with Java 9

前端 未结 5 1571
独厮守ぢ
独厮守ぢ 2020-11-30 05:40

Trying to compile a Maven project using JDK 9.0.1 I\'m facing this stacktrace without much of an explanation:

Exception in thread \"main\" java.lang.Assertio         


        
5条回答
  •  醉话见心
    2020-11-30 06:01

    I had a similar stacktrace (abbreviated):

    Exception in thread "main" java.lang.AssertionError at 
    jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
    ...
    ...javac.main.JavaCompiler.readSourceFile(....
    

    Since this occurred after a recent change to a library I had made, I traced the issue to a case change in a class name in one of my dependencies.

    My dependency had changed from having a class with, for example, BlahMDCCustomizer to having a class with the same name but camelcase for 'Mdc' - BlahMdcCustomizer. The source code I was trying to compile that used this library, had not yet been updated to the new name and still referenced the non-existent BlahMDCCustomizer. No amount of mvn cleaning, invalidating caches or restarts would resolve the issue.

    Once I updated my bad reference to BlahMDCCustomizer to the new name BlahMdcCustomizer, then mvn compile succeeded.

    So it would seem that the compiler code has some case-sensitive assertions inside a case-insensitive process. Posting this in case it sheds light on the issue for someone more familiar with the source!

    This was using JDK11 & maven 3.5.2, on Windows.

提交回复
热议问题