简体   繁体   English

在Maven中使用Java 10的Groovy 2.5.3

[英]Groovy 2.5.3 with Java 10 in Maven

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. 我正在尝试将我的Java / Groovy联合项目升级到Java 10,但我的希望和愿望似乎正在被Jigsaw项目的锯齿状岩石所破坏。

The relevant section of my Maven 3.6.0 POM looks like 我的Maven 3.6.0 POM的相关部分看起来像

<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 . 我也用通常的方式安装了GMavenPlus 1.6.2。 I have used Groovy 2.5.3 because when compiling with 2.4.13 GMavenPlus gives this error: 我使用了Groovy 2.5.3,因为在使用2.4.13 GMavenPlus进行编译时会出现此错误:

[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). 但是,在Groovy 2.5.3中,模块结构被更改为支持Java 9,现在我们需要导入具有类型pom groovy-all (如上所述)。 However, maven keeps trying to download groovy-all-2.5.3.jar , which according to this page doesn't exist any more. 但是,maven继续尝试下载groovy-all-2.5.3.jar ,根据此页面不再存在。

[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? 有谁知道怎么做到这一点?

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. 您应该升级到版本org.codehaus.groovy:groovy-all:3.0.0-alpha-3因为日志读取。

  2. You should upgrade to 2.1.0.RELEASE of spring-boot-starter-parent which out of the box supports Java until version 11. 你应该升级到spring-boot-starter-parent 2.1.0.RELEASE ,它开箱即用,支持Java直到版本11。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM