Steps to reproduce: * create a demo project from https://start.spring.io/ * using Maven + Groovy + Spring Boot 2.3.4 + Java15 * extract and run maven

mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/******/.sdkman/candidates/maven/current
Java version: 15, vendor: AdoptOpenJDK, runtime: /opt/owa/java/jdk-15+36
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-48-generic", arch: "amd64", family: "unix"
$ mvn package
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- gmavenplus-plugin:1.8.1:addSources (default) @ demo ---
[INFO] 
[INFO] --- gmavenplus-plugin:1.8.1:addTestSources (default) @ demo ---
[INFO] 
[INFO] --- gmavenplus-plugin:1.8.1:generateStubs (default) @ demo ---
[INFO] Using isolated classloader, without GMavenPlus classpath.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/******/.m2/repository/org/codehaus/groovy/groovy/2.5.13/groovy-2.5.13.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
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
[INFO] Using Groovy 2.5.13 to perform generateStubs.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.071 s
[INFO] Finished at: 2020-10-14T09:12:20-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.8.1:generateStubs (default) on project demo: **Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.8.1:generateStubs failed: Unrecognized target bytecode: '15'.** -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

The issue here is the version of gmavenplus-plugin being 1.8.1 which does not support Java15.

I did update the gmavenplus-plugin to 1.11.0 in the pom which supports Java15.

This time the issue is that the groovy version bundled with spring boot is too old. The plugin needs a groovy version 3.0.3 or higher. See issue below:

[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.11.0:generateStubs (default) on project demo: Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.11.0:generateStubs failed: **Target bytecode 15 requires Groovy 3.0.3 or newer.** -> [Help 1]

Comment From: wilkinsona

Thanks for the report.

Spring Boot doesn't have an opinion about the version of the gamvenplus-plugin that you use, that's coming from start.spring.io via the underlying Initializr library. I've opened https://github.com/spring-io/initializr/issues/1140.

https://github.com/spring-projects/spring-boot/issues/20119 is tracking an upgrade to Groovy 3. In the meantime you can override the version of Groovy to meet your needs using the groovy.version property.

Comment From: snicoll

Thanks @wilkinsona for the follow-up. For the record, start.spring.io has been upgraded to handle that use case out-of-the-box.