BUG! exception in phase 'semantic analysis'

后端 未结 5 650
感情败类
感情败类 2020-12-05 14:37

I have a 1.1.7 spring-boot app using Gradle 1.10 & jdk1.8. I use Groovy/Spock for testing It has two dependencies - jars build with Apache Maven 3.1.1 and jdk 1.8. I b

相关标签:
5条回答
  • 2020-12-05 15:12

    This happened to me when I upgraded my project with groovy Spock tests from JDK 8 to JDK 11.

    The fix was to upgrade spock version to 1.3-groovy-2.5 and groovy version to 2.5.3 for my gradle dependencies.

    In addition, in my case, I had to add implementation of jaxws and jaxb to my dependencies as they have been removed from JDK 11:

        implementation 'com.sun.xml.ws:jaxws-ri:2.3.2'
        implementation 'com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438'
    
    0 讨论(0)
  • 2020-12-05 15:16

    In my case the reason was IntellijIdea variable generation.

    Example: Idea generated List<@NotNull UUID> locationIds instead of List<UUID> locationIds

    Groovy compilation failed to process this @NotNull annotation inside generic brackets

    0 讨论(0)
  • 2020-12-05 15:17

    I had this BUG! exception in phase 'semantic analysis' in source unit '...' issue today and upgrading gradle (as mentioned in a comment) didn't work.

    What worked for me was cleaning the gradle cache:

    rm -rf $HOME/.gradle/caches/

    and project gradle directory

    rm -rf $PROJECT/.gradle/caches/ && rm -rf $PROJECT/build/

    Related How can I force gradle to redownload dependencies?

    0 讨论(0)
  • 2020-12-05 15:22

    I'm seeing the same error only when I use the Java 11 JVM:

    $ gradle -v
    
    ------------------------------------------------------------
    Gradle 5.2.1
    ------------------------------------------------------------
    
    Build time:   2019-02-08 19:00:10 UTC
    Revision:     f02764e074c32ee8851a4e1877dd1fea8ffb7183
    
    Kotlin DSL:   1.1.3
    Kotlin:       1.3.20
    Groovy:       2.5.4
    Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
    JVM:          11 (Oracle Corporation 11+28)
    OS:           Mac OS X 10.14.3 x86_64
    

    The error goes away when I drop back to Java 1.8 (I changed JAVA_HOME):

    $ gradle -v
    
    ------------------------------------------------------------
    Gradle 5.2.1
    ------------------------------------------------------------
    
    Build time:   2019-02-08 19:00:10 UTC
    Revision:     f02764e074c32ee8851a4e1877dd1fea8ffb7183
    
    Kotlin DSL:   1.1.3
    Kotlin:       1.3.20
    Groovy:       2.5.4
    Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
    JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
    OS:           Mac OS X 10.14.3 x86_64
    
    0 讨论(0)
  • 2020-12-05 15:29

    I think this is cause by java version is high, or we can say gradle version is too low.

    so I just use higher version Gradle. I think it's better than change JDK version to 1.8.

    My config(I already have gradle 6.5, and I think maybe 6.x will satisfy):

    just change the gradle version to 6.5 in android\gradle\wrapper\gradle-wrapper.properties

    0 讨论(0)
提交回复
热议问题