我正在尝试在Ubuntu 12.04上安装Gradle。起初我使用了存储库中的软件包,但在点击this bug之后,我发现我最好使用更新的版本。
我删除了内置软件包并安装了gradle,方法是将官方1.0软件包复制到/usr/local/share/
目录,并添加从/usr/local/bin/gradle/
到/usr/local/share/gradle-1.0/bin/gradle
的软链接。
它似乎工作,但我遇到了类路径问题。也就是说,一旦我尝试建立一个项目,我就会
Exception executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler@1ab95774 in compiler daemon: java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
> org/apache/commons/cli/ParseException
现在locate commons-cli.jar
给了我
/usr/share/groovy/lib/commons-cli.jar
/usr/share/java/commons-cli.jar
显然这两个JAR不在类路径上。通常我会运行带有-cp
选项的Java可执行文件来向类路径添加内容。但是gradle可执行文件本身是一个脚本,它在调用Java之前自己设置类路径。
安装Gradle并使其在类路径中找到所需内容的正确方法是什么?
请注意,我是JVM世界的新手,所以不要假设我熟悉任何事情: - )
答案 0 :(得分:2)
结果
就足够了groovy group: 'commons-cli', name: 'commons-cli', version: '1.0'
在依赖项下
答案 1 :(得分:0)
如何在linux中安装Gradle
从中下载成绩 https://services.gradle.org/distributions/gradle-2.3-all.zip
一个简单的旧学校规则:
提取到/ usr / local /
将路径添加到/etc/bash.bashrc
GRADLE_HOME =的/ usr /本地/ gradle这个-2.2.1 export GRADLE_HOME