Buildship - Credentials for distributionUrl not read from

OS: Ubuntu 16.04
Gradle Version: 4.4.1
Gradle User Home: /opt/gradle/gradle-4.4.1
Java Home: /usr/lib/jvm/java-8-oracle
Eclipse Version: Oxygen.2 Release (4.7.2)
Eclipse Build id: 20171218-0600
Eclipse Buildship: 2.2.1.v20180125-1441

in my project in the the distributionUrl points to an internal artifactory server where the gradle zip can be downloaded.
The server requires authentication with username/password which is set in the file in GRADLE_HOME (or is it GRADLE_USER_HOME?)
Anyway - it works when i call ./gradlew help in the command line, the gradle zip will be downloaded, the credentials in /opt/gradle/gradle-4.4.1/ were used.

The behaviour in eclipse is different. The same project is used. Gradle distribution in eclipse’ gradle settings is set to Gradle wrapper
If i click on Gradle -> Refresh Gradle Project the refresh fails with Could not install Gradle distribution from <theURL> - Server returned HTTP response code: 401 for <theURL>
This is the stacktrace:

org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from ‘’.
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(
at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(
at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.onStartAction(
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(
at org.gradle.internal.concurrent.ManagedExecutorImpl$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
at org.gradle.internal.concurrent.ThreadFactoryImpl$
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(
at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(
at org.gradle.tooling.internal.consumer.DefaultProjectConnection.getModel(
at org.eclipse.buildship.core.workspace.internal.ConnectionAwareLauncherProxy.newModelBuilder(
at org.eclipse.buildship.core.workspace.internal.DefaultModelProvider.fetchModel(
at org.eclipse.buildship.core.workspace.internal.DefaultModelProvider.supportsCompositeBuilds(
at org.eclipse.buildship.core.workspace.internal.DefaultModelProvider.fetchModels(
at org.eclipse.buildship.core.workspace.internal.DefaultModelProvider.fetchEclipseGradleProjects(
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.fetchEclipseProjects(
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(
at org.eclipse.buildship.core.util.progress.ToolingApiJob$
at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(
Caused by: Server returned HTTP response code: 401 for URL:
at org.gradle.wrapper.Download.downloadInternal(
at org.gradle.tooling.internal.consumer.DistributionInstaller$

This is the file:



The wrapper username and password values are loaded as JVM arguments when the wrapper download starts. This is different in Eclipse where Buildship and Eclipse share the same VM. Buildship doesn’t modify the system properties, causing your build to fail.

You can fix the problem by declaring your proxy settings in the Eclipse preferences. Or, you can work around the problem by specifying the proper JVM arguments in the eclipse.ini file.


thanks for your answer although this is not sufficient for me as i don’t want to edit the users eclipse.ini.
What if i put username und password into the GRADLE_OPT variable inside the gradlew script of the project?
Will the gradlew script be used to download the binary?

OK, adding username and password to GRADLE_OPTS in gradlew does not work:
GRADLE_OPTS=$GRADLE_OPTS" -Dgradle.wrapperUser=SomeUser -Dgradle.wrapperPassword=someAPIKEy3f067c70513193ae86f6a83507b131173e57332ac2c096e71"

works if you start the gradlew from commandline but it does not work if you click on Refresh Gradle Project although Gradle wrapper is used as Gradle distribution in the projects’ settings.


It looks like I’m having the same issue. I’m trying to get our custom gradle distribution init scripts to pick up system properties that are set in the file (the Buildship preferred way).

For example:

These system properties are picked up when run from the command line and the project builds as expected.

As an aside, for our IntelliJ users, we were able to set gradle VM options as a work around for what I assume is the same problem.

It seems like the older version of Buildship would have allowed the user to add these properties manually (not ideal but at least it would work). I wonder if it is possible for Buildship to parse a project’s file and make “systemProp” properties available to builds. Its not ideal but maybe something like that could work for this problem (if you don’t want to bring back allowing variables to be set manually)?

Since Buildship states to use the file for these settings, should we open an issue for this problem?

Thanks to the developers for the great work with Gradle and Buildship!

We used to have those options, but they would not solve the problem/ The passed arguments are only picked up by the JVM, a separate process downloads the wrapper. IDEA presumably works the same way. I tried specifying wrapper credentials, but they were ignored for the download.

Thanks for the reply! For my situation, the wrapper is stored on a public repository (bintray) and doesn’t require credentials to download. When the wrapper is extracted and run, the init scripts inside of the wrapper are actually what need the properties.

In IntelliJ, you are able to pass the system properties via “-D”. I’ve verified this works (not my actual information, obviously):

I don’t know what the difference is but it works there. I have verified it also works by modifying the eclipse.ini file and placing them after vmargs like so:


Modifying eclipse.ini or even the way we have to do it in IntellJ isn’t ideal as it forces each user to do something different in the IDE versus what they would do on the command line. If we could get it to grab the properties from the file, I think that would be preferable. Having the option via the Buildship GUI would be second, and modifying eclipse.ini is third, in my humble opinion.