我有一个用maven构建的相当普通的groovy项目。它使用gmavenplus插件,其中的pom直接从the gmaven plus web page中提升。
pom如下所示:
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.8.0</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>compile</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<!-- any version of Groovy \>= 1.5.0 should work here -->
<version>2.5.8</version>
<type>pom</type>
</dependency>
</dependencies>
</project>当我构建时,我在编译阶段得到以下错误。
[INFO] --- gmavenplus-plugin:1.8:compile (default) @ myapp---
[INFO] Unable to get Groovy version from GroovySystem, trying InvokerHelper.
[WARNING] Unable to get Groovy version from InvokerHelper or GroovySystem, trying jar name.
[ERROR] Unable to determine Groovy version. Is Groovy declared as a dependency?最后的maven错误会导致如下结果:
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.8:compile (default) on project myapp: Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.8:compile failed. NullPointerException -> [Help 1]我尝试了所有的技巧,黑客和诱骗,让它编译。实际上,我将groovy运行时作为直接模块依赖项(而不是maven托管依赖项)添加到Intellij中,从而使其正常工作,但这在命令行中不起作用。
我之前在同一台笔记本电脑上的gmaven plus 1.6和groovy 2.4.7上也有类似的设置,不知道为什么现在坏了。
发布于 2019-10-16 14:04:18
因此,我最终通过删除.m2代码库中的整个codehaus目录使其正常工作。重新下载一切似乎都能解决问题,现在一切都能正常工作,没有任何破解。
github的这个问题有点相关-- https://github.com/groovy/GMavenPlus/issues/84 --最后的评论让我想到了回购。
https://stackoverflow.com/questions/58406695
复制相似问题