Groovy 2.5.3 with Java 10 in Maven

Ken DeLong :

I am trying to upgrade my joint Java/Groovy projects to Java 10, but my hopes and aspirations appear to be being smashed upon the jagged rocks of Project Jigsaw.

The relevant section of my Maven 3.6.0 POM looks like

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
    <relativePath/>
</parent>
...
<java.version>10</java.version>
<groovy.version>2.5.3</groovy.version>
...
<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>${groovy.version}</version>
    <type>pom</type>
</dependency>

I also have GMavenPlus 1.6.2 installed in the usual way. I have used Groovy 2.5.3 because when compiling with 2.4.13 GMavenPlus gives this error:

[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.6.2:compile (default) on project batch: Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.6.2:compile failed: Target bytecode 10, 11, or 12 requires Groovy 2.5.3/3.0.0-alpha-4 or newer.  No 2.6 version is supported. -> [Help 1]

However, in Groovy 2.5.3 the module structure is changed to support Java 9 and now we need to import groovy-all with type pom (as above). However, maven keeps trying to download groovy-all-2.5.3.jar, which according to this page doesn't exist any more.

[ERROR] Failed to execute goal on project batch: Could not resolve dependencies for project XXX: Could not find artifact org.codehaus.groovy:groovy-all:jar:2.5.3 in XXX -> [Help 1]

Does anyone know how to get this going?

Naman :

Few suggestions you can follow to resolve this based on compatibility :

  1. You should upgrade to the version org.codehaus.groovy:groovy-all:3.0.0-alpha-3 as the log reads.

  2. You should upgrade to 2.1.0.RELEASE of spring-boot-starter-parent which out of the box supports Java until version 11.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=107728&siteId=1