LoginSignup
5

More than 3 years have passed since last update.

Thymeleaf Layoutでgroovyの警告が出る場合の対処法

Last updated at Posted at 2019-07-28

概要

JDK9から仕様が変わったリフレクション関係の警告
groovyは3.0から対応するようです。参考
β版が出ているので、暫定的に対象ライブラリのgroovyのjarを入れ替えれば警告は出なくなります。

環境

  • OpenJDK 11
  • Spring Boot 2.1.4
  • Thymeleaf Layout Dialect 2.3.0

警告

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:.m2/repository/org/codehaus/groovy/groovy/2.5.6/groovy-2.5.6.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

対策

対象ライブラリのgroovyを入れ替える

[pom.xml]
        <dependency>
          <groupId>nz.net.ultraq.thymeleaf</groupId>
          <artifactId>thymeleaf-layout-dialect</artifactId>
          <exclusions>
            <exclusion>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy</artifactId>
            </exclusion>
          </exclusions>
        </dependency>

        <!-- TODO 正式リリース待ち -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>3.0.0-beta-1</version>
        </dependency>

警告だけなんで、単純に警告を出さないようにするのも手みたいですね。
Java 10でSpring Boot 2.0 アプリケーションを開発するときの初歩的な注意点

まだβ版なんで本番環境へは正式リリースを待ちましょう!

参考

https://issues.apache.org/jira/browse/GROOVY-8339
https://qiita.com/rubytomato@github/items/3d9f657196c1e941699a

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5