gpt4 book ai didi

java - GMaven 构建失败并显示 "An API incompatibility was encountered"

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:10:27 25 4
gpt4 key购买 nike

尝试使用 Maven Gmaven 插件编译我的项目时,出现以下错误:

[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.4:compile (default) on project concorde-web: Execution default of goal org.codehaus.gmaven:gmaven-plugin:1.4:compile failed: An API incompatibility was encountered while executing org.codehaus.gmaven:gmaven-plugin:1.4:compile: java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ModuleNode.getStarImports()Ljava/util/List;

谷歌搜索表明这是因为多个 groovy 版本最终出现在我的依赖链中。但是,查看完整的依赖树后,发现全树只有一个依赖。

这是我的 pom.xml 的摘录:

    <!-- Groovy dependencies -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.5</version>
</dependency>
<!-- ... snip ... -->

<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

最佳答案

这是由 GMaven 插件定义中缺少 providerSelection 元素引起的。

正确的 GMaven 定义如下所示:

        <plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.4</version>
<configuration>
<providerSelection>1.8</providerSelection>
</configuration>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

关于java - GMaven 构建失败并显示 "An API incompatibility was encountered",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13113142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com