How to set correct project directory for GradleConnector. It points to ****/daemon/2.0/****


I use below code for starting Gradle to run some tests:

ProjectConnection connection = GradleConnector.newConnector()
                .useDistribution(new URI("file:///tmp/downloads/"))
 try {
           } finally {

I am wondering how to setup the project directory where GradleConnector points to. I get below exception, because the directory with the build file doesn’t exists. How can I set the path to the the existing build file I have created for the tests? The variable targetDir is set to the correct directory but it seems that GradleConnector don’t use it as it should be. How can I prevent that GradleConnector doesn’t use the “daemon/2.0” directory.

Caused by: org.gradle.api.InvalidUserDataException: Project directory ‘*/daemon/2.0/’ does not exist.

at org.gradle.initialization.ProjectDirectoryProjectSpec.checkPreconditions(

at org.gradle.initialization.AbstractProjectSpec.containsProject(

at org.gradle.initialization.SettingsHandler.findAndLoadSettings(

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(

at org.gradle.initialization.DefaultGradleLauncher.doBuild(

… 44 more

I would be glad, if someone can help me.

Best, Christian

Hey Christian, I can’t reproduce this behaviour. Could you provide a self contained example?

cheers, rené