Gradle将无法运行,java.lang.NoClassDefFoundError:groovy / lang / GroovyObject

时间:2012-04-14 20:33:37

标签: groovy gradle

我正在尝试使用Gradle进行基本构建。即使gradle -v失败,也会出现以下情况:

$ gradle -v

FAILURE: Build aborted because of an internal error.

* What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://www.gradle.org.

* Try:
Run with --debug option to get additional debug info.

* Exception is:
java.lang.NoClassDefFoundError: groovy/lang/GroovySystem
    at org.gradle.util.GradleVersion.prettyPrint(GradleVersion.java:183)
    at org.gradle.launcher.CommandLineActionFactory$ShowVersionAction.run(CommandLineActionFactory.java:181)
    at org.gradle.launcher.CommandLineActionFactory$ActionAdapter.execute(CommandLineActionFactory.java:199)
    at org.gradle.launcher.CommandLineActionFactory$ActionAdapter.execute(CommandLineActionFactory.java:191)
(stacktrace snipped)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:28)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovySystem
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 17 more

所以,我想“啊哈,我的课程路径是空的。让我加上groovy”。

$ export CLASSPATH=/usr/share/gradle/lib/groovy-all.jar && echo $CLASSPATH
/usr/share/gradle/lib/groovy-all.jar

没有区别。

对于它的价值,这是build.gradle:

apply plugin: 'eclipse'
apply plugin: 'groovy'

repositories {
    mavenCentral()
}

dependencies {
    groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.7.10'
    testCompile group: 'junit', name: 'junit', version: '4.8.2'
}

我发现唯一相关的stackoverflow问题是this,谷歌并没有那么好。

install doc for gradle说“Gradle附带了自己的Groovy库,因此不需要安装Groovy。”这意味着类路径是不必要的。那为什么我不能运行呢?

1 个答案:

答案 0 :(得分:1)

听起来像是一个损坏的Gradle安装。也许你没有调用你认为的gradle脚本。