[英]Groovy Maven Compilation fails with error: Unable to determine Groovy version. Is Groovy declared as a dependency?
我有一個相當普通的 groovy 項目,它使用 maven 構建。 它使用 gmavenplus 插件,pom 直接從gmaven plus web 頁面提升
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 進行了類似的設置,不知道為什么現在會損壞。
因此,我最終通過刪除 .m2 存儲庫中的整個 codehaus 目錄使其正常工作。 重新下載一切似乎都解決了,現在一切正常,沒有任何黑客攻擊。
這個 github 問題有點相關 - https://github.com/groovy/GMavenPlus/issues/84 - 最后的評論讓我對 repo 進行了更新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.