Gradle not working after fresh new install on debian linux - gradle

I just installed gradle on debian using the sudo apt-get install gradle command. When i try to run gralde afterwards it throws the following stack trace :
org.gradle.api.internal.classpath.UnknownModuleException: Cannot
locate JAR for module 'ant' in distribution directory 'null'.
at org.gradle.api.internal.classpath.DefaultModuleRegistry.findExternalJar(DefaultModuleRegistry.java:242)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.getExternalModule(DefaultModuleRegistry.java:101)
at org.gradle.api.internal.DefaultClassPathProvider.findClassPath(DefaultClassPathProvider.java:46)
at org.gradle.api.internal.DefaultClassPathRegistry.getClassPath(DefaultClassPathRegistry.java:34)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:43)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Gradle by default gets installed into
/usr/share/gradle
I have all the jars gradle requires in my jdk, so is there any way to tell gradle to search for the libraries there and start to work ?

Try to set your GRADLE_HOME
export GRADLE_HOME=/usr/share/gradle
Is there a lib under that directory? It should have the ant jar.

Related

How to tell gradlew to use existing gradle rather than downloading it everytime?

Sorry, have no gradle experience before, play with https://spring.io/guides/gs/rest-service/
MINGW64 /d/workspace/gs-rest-service/complete (master)
$ ./gradlew bootRun
Downloading https://services.gradle.org/distributions/gradle-4.6-bin.zip
I already installed gradle here:
MINGW64 ~
$ /d/prefix/gradle-5.5/bin/gradle
> Task :help
Welcome to Gradle 5.5.
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
To see more detail about a task, run gradle help --task <task>
For troubleshooting, visit https://help.gradle.org
BUILD SUCCESSFUL in 599ms
1 actionable task: 1 executed
How can I tell gradlew to use installed one, do not download it everytime enerywhere
The Gradle wrapper, gradlew, will always download the specific version of Gradle configured in <project>/gradle/wrapper/gradle-wrapper.properties if that version of Gradle has not been downloaded before (and is available at ~/.gradle/wrapper/dists). The reason is that the project is supposed to know best with which version of Gradle it should be used. If you still want to use your globally installed version of Gradle, simply add it to PATH and call gradle instead of gradlew.

debugging elasticsearch github project on intellij

I have cloned the elasticsearch github repo on my linux machine and i have java 8. I go to the directory elasticsearch and run the command "gradle build" . But it throws me error saying there is an error in :
Build file '/home/tracxn-lp-354/Documents/sanchit/elasticsearch/benchmarks/build.gradle' line: 31
What went wrong:
A problem occurred evaluating project ':benchmarks'.
Failed to apply plugin [id 'elasticsearch.build']
Java 1.9 or above is required to build Elasticsearch
As the error says, you need to install a newer version of java.
What version of java does it say it's running?
java -version
If it doesn't say 1.9 then you need an upgrade!
sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer
java -version
sudo apt-get install oracle-java9-set-default
--
Once all this is done:
Make sure to open Project Structure in IntelliJ and navigate to:
Project->Project SDK.
Specify the latest version of the Java JDK (9) and click Apply.
First of all, make sure you installed Java 9 (JDK 9 is required to build Elasticsearch).
Now, run the following command from Elasticsearch root directory (it automatically configures IDE):
gradle idea
After that, open Elasticsearch project from IntelliJ IDEA with enabled Gradle auto-import. This step is important, because it setups correct project structure for IDEA (content root, source folders, etc):
File -> New -> Project from Existing Sources... -> Import Gradle Project
And make sure that Project SDK is set to the Java version 9.
Now, to debug Elasticsearch, go to the Run -> Edit Configurations menu and add the following configurations:
Add breakpoint somewhere, for example in:
server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java
And run Debug 'Elasticsearch' (Shift + F9 in IntelliJ IDEA).
P.S. The process might be time consuming, so be patient and enjoy the result!

Error: Could not find or load main class org.apache.tools.ant.launch.Launcher osx jenkins slave

I have tried to build on jenkins slave with osx on it and got this error. When I log into machine, I can run ant -version and it works. Only when I try to build from jenkins this error occurs:
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
I have found that the problems lies within brew version of ant. If i have installed separate version it works. I have found that it may be caused by different dir structure. In Brew version there is a libexec dir whether in "ordinary" there is a lib dir. Maybe creating symlink to libexec with lib name it would work but i haven't checked it.

Maven not getting installed

I have installed maven in RedHat
by curl http://www.jpackage.org/jpackage50.repo > /etc/yum.repos.d/jpackage.repo
yum install maven2
and when i hit
mvn --version
getting this error
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
I came across similar problem and after adding below environment variables it worked for me
export M2_HOME=<your apache-maven installation path up to bin>
export JAVA_HOME=<your Java installation path up to bin>
Also modify your PATH variable
Instead of doing that you can copy maven source and point M2_HOME to that location.

Error building hadoop 1.0.1 - missing pom.xml

I followed the instructions given here to download and build hadoop 1.0.1 from this repository. I have installed JDK, Maven, cmake, autoconf etc. When I run th efollowing command from the hadoop top level directory
mvn -e package -Pdist -Pdoc -Psrc -Dtar -DskipTests
mvn reports an error saying that no pom.xml is found. There is no pom.xml file in the folder or any subfolders.
As far as I investigate the Hadoop Common tags, only version 0.23.x and 2.0.x is a Maven project. The rest is an Ant and/or Ivy project. Please note If there is no pom.xml it is not a Maven project.
If you would like to build the version 1.0.1, please use Apache Ant or Apache Ivy instead.

Resources