gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'd:/home/gradle/gradle-1.2'


(dlaxman508) #1
I am executing the build.gradle file using gradle tooling API in the linux environment.am using the below code snippet
   String gradleHome = System.getenv("GRADLE_HOME");
 ProjectConnection connection = GradleConnector.newConnector().useInstallation(new File(gradleHome)).forProjectDirectory(new File(deployGradleFolderPath)).connect();
   try{
   BuildLauncher build = connection.newBuild();
   build.forTasks("deploy"); // select tasks to run:
   build.withArguments("-I","myinitscript.gradle","-b", "xyz.gradle", "-i");
   build.setJvmArguments(GradleConstants.jvmArguments);
   build.run();
   }catch(Exception e){
   }
Its throwing the below exception in linux environment.
Note: am able to run the same code successfully in windows environment.Please let me know if any extra settings required in linux environment.
Tooling API uses target gradle version: 1.2.
org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'd:/home/gradle/gradle-1.2'.
        at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
        at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:71)
        at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.gradle.internal.nativeplatform.filesystem.FileSystems$DefaultFileSystem

(Szczepan Faber) #2

Please verify the Gradle installation dir you pass to the GradleConnector. ‘d:/home/gradle/gradle-1.2’ does not look like a good linux path :slight_smile:

Hope that helps!