Skip to content

Why it downloads Gradle when I open a single java file #901

Open

Description

@Eskibear

The issue is found when I'm using a VM without network access. It's a clean installed Windows, OpenJDK 8u202, VS Code 1.33.1, vscode-java is the only extension installed.

When I open a .java file, vscode activates the extension, and there's an error in the log. Attaching the full log: vscode-java-no-network.log

Why does it have to download the Gradle when I'm not opening a gradle project? IMO it would be good if the downloading only happens when I'm working on a gradle project.

...
!ENTRY org.eclipse.buildship.core 2 0 2019-04-25 13:08:11.621
!MESSAGE Could not load Gradle version information
!STACK 0
org.gradle.api.UncheckedIOException: Cannot download published Gradle versions.
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:164)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.tryToDownloadAndCacheVersions(PublishedGradleVersions.java:148)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.create(PublishedGradleVersions.java:108)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersionsWrapper$LoadVersionsJob.run(PublishedGradleVersionsWrapper.java:62)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.net.UnknownHostException: services.gradle.org
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:161)
	... 4 more

!ENTRY org.eclipse.jdt.ls.core 1 0 2019-04-25 13:08:12.170
!MESSAGE Finished creating the Java project jdt.ls-java-project

...

Activity

  1. fbricon commented on Apr 26, 2019

    @fbricon
    Collaborator

    This is most likely caused by eagerly activating the Buildship plugin when the server initializes. There might be ways to delay that activation (same thing for M2E) but it might be tricky

  2. tsmaeder commented on Nov 21, 2019

    @tsmaeder
    Contributor

    @fbricon downloading stuff from fixed locations is a problem in airgapped or disconnected cases. Can we ensure somehow we can override all downloads or make sure required stuff is local already? Like we do for maven repos in the maven config in ~/.m2?

  3. snjeza commented on Nov 21, 2019

    @snjeza
    Collaborator

    @tsmaeder You can try to set the following file - https://services.gradle.org/versions/all
    to ~/.tooling/gradle/versions.json

  4. fbricon commented on Nov 21, 2019

    @fbricon
    Collaborator

    @snjeza Buildship also has an offline preference, we should expose as a jdt.ls setting too. Can you please look into it?

  5. tsmaeder commented on Nov 21, 2019

    @tsmaeder
    Contributor

    @tsmaeder You can try to set the following file - https://services.gradle.org/versions/all
    to ~/.tooling/gradle/versions.json

    I don't understand what you mean. Can you rephrase, @snjeza ?

  6. self-assigned this
    on Nov 21, 2019
  7. snjeza commented on Nov 21, 2019

    @snjeza
    Collaborator

    @Eskibear you can try to create C:\Users<your_username>.tooling\gradle\versions.json. It can be empty if you don't use Gradle.

  8. snjeza commented on Nov 21, 2019

    @snjeza
    Collaborator

    Buildship also has an offline preference, we should expose as a jdt.ls setting too. Can you please look into it?

    The Buildship Offline Mode preference starts a gradle build with the --offline option. See #1157

  9. tsmaeder commented on Nov 22, 2019

    @tsmaeder
    Contributor

    Ok @snjeza , @fbricon thanks for the info. --offline is not what we need for "airgapped". Airgapped is an enironment where you have for example a company intranet, but are not connected to the internet, so we'd have to replace remote servers (repos) with local ones (like we can do in the maven settings). Would ~/.tooling/gradle/versions.json allow us to override the server locations? Is there another way to achieve that in gradle? Do you know, @snjeza ?

  10. snjeza commented on Nov 22, 2019

    @snjeza
    Collaborator
  11. tsmaeder commented on Nov 25, 2019

    @tsmaeder
    Contributor

    @snjeza "offline" is not what we're looking for. We need "airgapped", basically a way to set it up that when a project tries to resolve a project from maven central, it goes to a server somewhere on the local network. Do you happen to know how that can be set up per user or globally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions