redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.07k stars 429 forks source link

Add option to force maven sources download #2455

Open raulvaldoleiros opened 2 years ago

raulvaldoleiros commented 2 years ago

It would be nice if an option to force maven sources download is available, for big repositories I don't want to restart the vscode just to force it.

Thanks

rgrunber commented 2 years ago

This should be the case already since https://github.com/redhat-developer/vscode-java/issues/1664 . It's working for me and I'm not using java.maven.downloadSources (this just ensures all sources get downloaded at import). Do you have a sample project for which it isn't working that can be shared ?

Note, in the past I ran into some issues where if a particular artifact took too long to download, the javadoc / definition support (whatever triggered the download) would default to the decompiled sources, and I don't think it would try again until a restart (or maybe workspace clean).

raulvaldoleiros commented 2 years ago

@rgrunber thanks for the reply. Actually my use case is, in our company the maven repository are private and only accessible through VPN, sometimes I forgot to connect the VPN and it fails downloading the sources. In this scenario I want to force the download of the sources, without restarting and clearing the language server 😜 When my VPN is on, everything works fine.

Maybe it is already possible and I don't know how to do it, if is the case can you point me in the right direction?.

rgrunber commented 2 years ago

I haven't tried it yet, but I wonder if it's as simple as reducing the cache eviction time in MavenSourceDownloader

Alternatively, have you tried just using the Clean Java Language Server Workspace from the command palette (ctrl+shift+p). It will re-import the project, but won't require re-opening VS Code.

raulvaldoleiros commented 2 years ago

I didn't tried with Clean java language server workspace, but it will trigger a full build in my workspace and I'm trying to avoid it 😛