Andrea
Andrea

Reputation: 20493

Installing Gradle on Ubuntu 12.04

I am trying to install Gradle on Ubuntu 12.04. At first I used the package in the repository, but after hitting this bug it turned out I'd better use a more recent version.

I have removed the built-in package and installed gradle by copying the official 1.0 package into the /usr/local/share/ directory and adding a soft link from /usr/local/bin/gradle/ to /usr/local/share/gradle-1.0/bin/gradle.

It appears to work, but I run into a classpath problem. Namely as soon as I try to build a project I get

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

Now locate commons-cli.jar gives me

/usr/share/groovy/lib/commons-cli.jar
/usr/share/java/commons-cli.jar

Apparently those two JARs are not on the classpath. Normally I would run a Java executable with the -cp options to add stuff to the classpath. But the gradle executable itself is a script that sets the classpath on its own before calling Java.

What is the correct way to install Gradle and make it find everything that needs on its classpath?

Please, note that I am a complete newbie to the JVM world, so do not assume I am familiar with anything :-)

Upvotes: 7

Views: 6660

Answers (2)

mig
mig

Reputation: 41

How to install Gradle in linux

Download Grade from https://services.gradle.org/distributions/gradle-2.3-all.zip

A simple old school rule to set up:

Extract is to /usr/local/

Add the path in to /etc/bash.bashrc

GRADLE_HOME=/usr/local/gradle-2.2.1 export GRADLE_HOME

Upvotes: 0

Andrea
Andrea

Reputation: 20493

It turned out to be enough to put

groovy group: 'commons-cli', name: 'commons-cli', version: '1.0'

under dependencies

Upvotes: 2

Related Questions