Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Eskibear opened this issue Apr 26, 2019 · 12 comments
Open

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

Eskibear opened this issue Apr 26, 2019 · 12 comments
Assignees
Labels

Comments

@Eskibear
Copy link
Contributor

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

...

@fbricon
Copy link
Collaborator

fbricon commented Apr 26, 2019

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

@tsmaeder
Copy link

@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?

@snjeza
Copy link
Contributor

snjeza commented Nov 21, 2019

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

@fbricon
Copy link
Collaborator

fbricon commented Nov 21, 2019

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

@tsmaeder
Copy link

@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 ?

@snjeza snjeza self-assigned this Nov 21, 2019
@snjeza
Copy link
Contributor

snjeza commented Nov 21, 2019

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

@snjeza
Copy link
Contributor

snjeza commented Nov 21, 2019

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

@tsmaeder
Copy link

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 ?

@snjeza
Copy link
Contributor

snjeza commented Nov 22, 2019

@tsmaeder
Copy link

tsmaeder commented Nov 25, 2019

@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
Labels
Projects
None yet
Development

No branches or pull requests

5 participants