scalameta / metals-vscode

Visual Studio Code extension for Metals
https://marketplace.visualstudio.com/items?itemName=scalameta.metals#overview
Apache License 2.0
298 stars 75 forks source link

metals 1.27 not starting on vscode 1.85.2 on RHEL Linux 7.9 air gapped (https://repo1.maven.org not accessible) #1454

Closed marc-personeni closed 7 months ago

marc-personeni commented 7 months ago

On startup of vscode the metals extension outputs this and nothing happens.

vs-code-metals-issue

The url of the maven repo is public and not authorised in our air-gapped environment. Is there a parameter to use our artifactory remote instead of repo1.maven.org?

To Reproduce Steps to reproduce the behavior:

  1. On a freshly installed RHEL 7.9 machine.
  2. With a freshly installed vscode 1.85.2.
  3. With all Microsoft recommended Extensions installed from VSIX.
  4. install metals extension 1.27 from VSIX
  5. Stop and restart code OR click the extension's "start metals" button
  6. See error

Expected behavior

I was hoping to be able to create a New Scala Project from the metals extension as set is not allowed in our environment (the expectation is that everything should be maven driven)

Screenshots

vs-code-metals-issue-2

Installation:

Additional context The maven builds work well with our Artifactory "maven remote" and our settings.xml. The proxy team will not white list repo1.maven.org. Instead we have to use our "maven remote" in Artifactory.

Ideally I would find a setting to customise the maven repo url. I tried the "Custom repositories" but it still bumps on searching in "repo1.maven.org"

vs-code-metals-possible-solution

Search terms

marc-personeni commented 7 months ago

Update I managed to connect to my artifactory using the "Coursier Repositories" field instead of "Custom repositories" now all the repo1.maven.org dependencies are coming in.

Continuation of the problem though, some dependencies seem to be sourced from a snapshot repo on oss-sonatype.org. Same problem but other repo url.

tgodzik commented 7 months ago

Thank, which dependencies are failing for you? Ideally, we should only use maven central for non snapshot releases.

By "Coursier Repositories" do you mean coursier mirrors field?

marc-personeni commented 7 months ago

Hi Tomasz,

Yes "coursier mirrors" is what I meant. This is what I get in vscode output tab for metals (at the end after all maven dependencies are retrieved)

It Seems like

  1. Three POMs come from dl.bintray.com and oss.sonatype.org
  2. One ivy.xml is looked up in maven central (via my remote) but not found

Resolution error: Error downloading org.scalameta:metals_2.13:1.2.0 not found: /MY_HOME_PATH/.ivy2/local/org.scalameta/metals_2.13/1.2.0/ivys/ivy.xml unauthorized: https://**USER_AND_TOKEN**@**MY_ARTIFACTORY_SERVER**:443/artifactory/mavencentral-remote/org/scalameta/metals_2.13/1.2.0/metals_2.13-1.2.0.pom (Artifactory Realm) download error: Caught java.net.UnknownHostException (dl.bintray.com) while downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.13/1.2.0/metals_2.13-1.2.0.pom download error: Caught java.net.UnknownHostException (oss.sonatype.org) while downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.13/1.2.0/metals_2.13-1.2.0.pom download error: Caught java.net.UnknownHostException (oss.sonatype.org) while downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.13/1.2.0/metals_2.13-1.2.0.pom Downloading Metals failed with the following: Process exited with code 1 Error, couldn't show release notes for Metals 1.2.0 Error: getaddrinfo ENOTFOUND api.github.com

tgodzik commented 7 months ago

Looks like we haven't found the needed jars in the artifactory:

Resolution error: Error downloading org.scalameta:metals_2.13:1.2.0
not found: /MY_HOME_PATH/.ivy2/local/org.scalameta/metals_2.13/1.2.0/ivys/ivy.xml
unauthorized: https://USER_AND_TOKEN@MY_ARTIFACTORY_SERVER:443/artifactory/mavencentral-remote/org/scalameta/metals_2.13/1.2.0/metals_2.13-1.2.0.pom (Artifactory Realm)

The rest are fallback, where we also look, but they are not available.

Any idea why it wouldn't be available there?

marc-personeni commented 7 months ago

Oh that's odd! 1.2.0 is found on Maven Central website, but not on repo.maven.apache.org (What my Artifactory remote points at) I also checked on https://repo1.maven.org (the offical url listed by sonatype), it is not there either. I thought all these were mirrors.

on_maven_central on_repo_maven_apache_org
marc-personeni commented 7 months ago

I just checked the maven-metadata.xml above. It reports an update on the 12 of December 2023, relating to 1.2.0 but the 1.2.0 is not present.

marc-personeni commented 7 months ago

Also I don't know if that helps but just in case... I just installed metals 1.2.0 on a Mac (instead of Linux) with vscode 1.85.1 (instead of 1.85.2) and it installed OK all from repo1.maven.org (no fallback repos used).

tgodzik commented 7 months ago

I think the problem here is the metals dependency is not available on that repo. Not sure if we can do anything about it. There is a wider issue where an air gapped machine is also discussed, so I think it might be worth concentrating the discussion there.

https://github.com/scalameta/metals/issues/4706