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

Installation problems in VSCode #383

Closed
mpilquist opened this issue Dec 7, 2018 · 13 comments
Closed

Installation problems in VSCode #383

mpilquist opened this issue Dec 7, 2018 · 13 comments

Comments

@mpilquist
Copy link

I tried installing 0.3.1 in to VSCode -- disabled other Scala language servers.

Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
logging to file /Users/mpilquist/Development/project/.metals/metals.log
Unable to automatically connect to build server.
skipping build import with status 'Failed'

Restarting the Metals server & reconnecting to the server results in the same errors as above. Note my default Java is OpenJDK 11 but I have the path to JDK 8 specified in Metals settings.

@gabro
Copy link
Member

gabro commented Dec 7, 2018

Can you try and see whether manually executing the "Import build" command gives the same error?

You can run it from the command palette.

@mpilquist
Copy link
Author

Thanks, that definitely helped with getting better diagnostics.

Import project failed, no functionality will work. See the logs for more details

Log shows that my problem on this particular project is that it's launching sbt and trying to load the project's plugins, which are not available on a public resolver. To resolve that error for this particular project, I'd need the ability to customize the SBT launcher to use and perhaps customize SBT args.

I tried on an open source project (fs2) and things are working great after disabling the other language server plugins.

@olafurpg
Copy link
Member

olafurpg commented Dec 7, 2018

@mpilquist are you behind a proxy? You may need to configure system properties to make it work then. It's undocumented at the moment, I've been meaning to add a section on proxies for a while.

@mpilquist
Copy link
Author

Not behind a proxy exactly -- rather, I have to launch sbt with these args:

sbt -sbt-dir "$SBT_ENV_HOME" -ivy "$IVY_HOME" "$@"

Where SBT_ENV_HOME/repositories contains a bunch of custom resolvers and SBT_OPTS contains -Dsbt.override.build.repos=true -Divy.home=${IVY_HOME}.

@olafurpg
Copy link
Member

olafurpg commented Dec 7, 2018

That would explain it, Metals uses an embedded sbt launcher by default since that helped out on Windows. We should support executing the user's 'sbt' command, but it's not implemented at the moment.

@gabro
Copy link
Member

gabro commented Dec 7, 2018

Adding configurable sbt options similarly to the Java options we already have should be easy, wdyt @olafurpg?

@olafurpg
Copy link
Member

olafurpg commented Dec 8, 2018

I opened #387 adding support for .sbtopts, .jvmopts and allowing users add custom JVM options when metals launches sbt. I'm not sure if this fixes your problem @mpilquist but it's a good first step.

If that doesn't do the trick we probably need another option to run the user's sbt command directly, but I'm hesitant to go that route since it didn't work reliably on Windows when I tried.

@mpilquist
Copy link
Author

mpilquist commented Dec 8, 2018 via email

@gabro
Copy link
Member

gabro commented Dec 8, 2018

@mpilquist from what I can tell, #387 also allows to provide a custom sbt launcher:

https://github.com/olafurpg/metals/blob/2d201096264182f20e56b3e29837739c4f6a6a7f/metals/src/main/scala/scala/meta/internal/metals/UserConfiguration.scala#L34

That should satisfy your use case, right?

@olafurpg
Copy link
Member

olafurpg commented Dec 8, 2018 via email

@mpilquist
Copy link
Author

mpilquist commented Dec 9, 2018

@olafurpg Yeah, either everyone needs a copy of the launcher script or everyone needs to configure ~/.sbt/repositories to point to the corporate proxy. The latter works fine if you aren't doing open source work on the same machine. My launcher script is sort of a lightweight equivalent to rbenv which adjusts SBT & Ivy settings based on the project / directory.

The .sbtopts approach didn't work for me in the past, as some of the environments need global SBT config and the launcher ensures those are all configured appropriately.

@olafurpg
Copy link
Member

olafurpg commented Dec 9, 2018

@mpilquist Thanks for the context. I'll update #387 to support executing a custom sbt script to see if that does the trick.

@olafurpg
Copy link
Member

olafurpg commented Dec 14, 2018

The installation instructions for "Import build" have been updated to include the steps to customize the sbt executable.

vscode-sbt-script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants