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

Coursier bootstrap downloads from maven central without using custom repositories #126

Closed
rajeshK88 opened this issue Jul 11, 2019 · 27 comments · Fixed by #161
Closed

Coursier bootstrap downloads from maven central without using custom repositories #126

rajeshK88 opened this issue Jul 11, 2019 · 27 comments · Fixed by #161
Labels
bug Something isn't working

Comments

@rajeshK88
Copy link

Unable to download coursier-cli_2.12-1.1.0-M13-2-standalone.jar

To Reproduce Steps to reproduce the behavior:

  1. Go to 'install metals for vs code'
  2. See error
    Java home: C:\Program Files (x86)\Java\jdk1.8.0_201
    Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.12/1.1.0-M13-2/coursier-cli_2.12-1.1.0-M13-2-standalone.jar: Connection timed out: connect, ignoring it

Expected behavior
Should allow to download this coursier.

Installation:

  • Operating system: macOS/Windows
  • VSCode version: 1.36.1
  • VSCode extension version:
  • Metals version: (found in VSCode settings, under metals.serverVersion) : 1.5.1

Additional context
I tried to install the metals in visual studio code but immediately got the above error. It is trying to download coursier from repo1.maven.org . But we have separate repository to download this part. not able to setup custom repository to download coursier. Also i did the proxy setting but it did not help. So all i want to update the repo to my custom repo. Also tried to do custom repo config option but that also did not help.

here is the settings i am using for custom repository which i did by adding environment variables :
COURSIER_REPOSITORIES="ivy2Local|central|sonatype:releases|jitpack|/"

Search terms
Unable to download coursier-cli_2.12-1.1.0-M13-2-standalone.jar

@tgodzik
Copy link
Contributor

tgodzik commented Jul 16, 2019

Sorry for not responding earlier. Have you tried following:
https://github.com/scalameta/metals-vscode#custom-artifact-repositories-maven-or-ivy-resolvers
?

Edit: After reading again I see you tried that. Hmm... Not sure what's going on.

@tgodzik
Copy link
Contributor

tgodzik commented Jul 16, 2019

Ok, I think I know what's going on. You should specify the setting in Metals using spaces and not pipes:
ivy2Local central sonatype:releases jitpack /

Also, this setting was added in 1.4.0, so it will not work in older versions. And since you have 1.5.1 Metals version I think the extension version might be older than 1.4.0

@rajeshK88
Copy link
Author

I tried with spaces but it still did not resolve. I have digged more on that. Seems like.. coursier wants to download the coursier-cli_2.12-1.1.0-M13-2-standalone.jar from its artifact settings which is repo1.maven.org not custom artifact from visual studio code metals extension custom artifact.

I don't know how to by pass this one..

Found one solution:

** NOTE: it is manual installation as of now as I do not find any permanent solution for that. **

  1. I downloaded manually coursier-cli_2.12-1.1.0-M13-2-standalone.jar from my custom artifact.

  2. By default Coursier used to put all the data in cache directory(Refer this link for cache path https://get-coursier.io/docs/cache) unless you have defined custom CACHE PATH.
    For example : If it is windows and if you are using default cache path, then put your standalone jar in following locations
    %LOCALAPPDATA%/Coursier/Cache/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.12/1.1.0-M13-2/

  3. Now you can use custom artifact by adding either environment variables or metals extension custom artifact.

For environment variables : refer this link https://get-coursier.io/docs/other-repositories
For metals extension in vs code : just add your custom artifact in custom artifact settings for metals extension.

@tgodzik
Copy link
Contributor

tgodzik commented Jul 22, 2019

@rajeshK88 were you able to get a log of what command is being run?

@rajeshK88
Copy link
Author

rajeshK88 commented Jul 22, 2019

@tgodzik

I checked the logs but dont see any metals logs but I am pretty sure, below command is running.
java -jar ./coursier fetch -p --ttl Inf org.scalameta:metals_2.12:07.0

But I tried to check coursier manually.. i just went to ~/.vscode/extensions/scalameta.metals-1.5.1 and try to run ./coursier --help and java -jar ./coursier --help . Both giving same error as mentioned above .

I believe coursier is taking default maven repo(https://repo1.maven.org/maven2) path instead going to my custom repo to download those standalone jar file.. Let me know if you need more info..

@tgodzik
Copy link
Contributor

tgodzik commented Jul 25, 2019

I haven't had a chance to reproduce this, but have you tried running coursier manually with added repository?

java -jar ./coursier fetch -r ${CUSTOM_REPOSITORY} -p --ttl Inf org.scalameta:metals_2.12:7.0.0
with CUSTOM_REPOSITORY set to your custom repository?

@rajeshK88
Copy link
Author

I tried coursier to download using custom repo and also tried the above command you mentioned and I got same issue. This issue is only happening if you have custom repo and your firewall is not giving permission to download the application from external link like (https://repo1.maven.org etc). Let me know if you need more info on this.

@tgodzik
Copy link
Contributor

tgodzik commented Jul 30, 2019

Not sure I understand, the command above doesn't work?
Are you sure Metals is available in your custom repository and that repository is accessible?
-r specifies an alternative repository to use and coursier should download Metals form there.

Examples being:

-r central
-r sonatype:snapshots
-r https://oss.sonatype.org/content/repositories/snapshots
-r "ivy:https://repo.typesafe.com/typesafe/ivy-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]"

@rajeshK88
Copy link
Author

rajeshK88 commented Jul 30, 2019

i am pretty sure the metals jar file is out there in my custom repos..

the problem is, To start coursier, it is need a standalone jar coursier-cli_2.12-1.1.0-M13-2-standalone.jar which is configured to download from repo1.maven.org. If you see my solution
#126 (comment) . the coursier is able to take custom repo once it is getting that standalone jar file.

this standalone jar file also present in custom repo. So not sure how to fix it.

the command above means java -jar ./coursier fetch -r ${CUSTOM_REPOSITORY} -p --ttl Inf org.scalameta:metals_2.12:7.0.0

Also I tried the example you have mentioned in above comment but getting same error like Java home: C:\Program Files (x86)\Java\jdk1.8.0_201 Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.12/1.1.0-M13-2/coursier-cli_2.12-1.1.0-M13-2-standalone.jar: Connection timed out: connect, ignoring it

I think the solution could be providing standalone jar file in visual studio metals plugin code itself...

@tgodzik
Copy link
Contributor

tgodzik commented Jul 30, 2019

What did you set your CUSTOM_REPOSITORY to?

If it's not picking up the additional repository then it's a bug in coursier, but are you specifying it correctly?

@rajeshK88
Copy link
Author

I set my CUSTOM_REPOSITORY like this ivy2Local|central|sonatype:releases|jitpack|{my custom repo}. As i mentioned, once coursier is able to see the standalone jar, it is able to pick up custom_repos but not before that. That is the pain point.

any way , for me the workaround is #126 (comment)

I was just checking , if in case you find some permanent solution for this.

@tgodzik
Copy link
Contributor

tgodzik commented Jul 30, 2019

Ok, I think I know what is going on. Sorry that it took so long 😯

@tgodzik tgodzik changed the title Unable to download coursier-cli_2.12-1.1.0-M13-2-standalone.jar Coursier bootstrap downloads from maven central without using custom repositories Jul 30, 2019
@tgodzik tgodzik added the bug Something isn't working label Jul 30, 2019
@rajeshK88
Copy link
Author

Cool, so are you planning to fix this ? If yes , can you share your thoughts to solve this issue ?

@tgodzik
Copy link
Contributor

tgodzik commented Jul 30, 2019

Not sure yet. We either do standalone coursier which weights much more (26 MB) or change the way we resolve. @olafurpg Do you have any idea what we can do?

@rajeshK88
Copy link
Author

@tgodzik anybody is working on this ?

@tgodzik
Copy link
Contributor

tgodzik commented Aug 8, 2019

Not at the moment, we still need to discuss this.

@rajeshK88
Copy link
Author

just wondering if anybody got chance to fix this ?.. actually long time waiting for this so that i can use it ?

@tgodzik
Copy link
Contributor

tgodzik commented Sep 12, 2019

just wondering if anybody got chance to fix this ?.. actually long time waiting for this so that i can use it ?

Sorry! This isn't a priority for us, but you are welcome to take a look at it yourself. Unfortunately, I can't provide any timeline here.

@olafurpg
Copy link
Member

@rajeshK88 What happens if you configure a Maven mirror as described here? https://get-coursier.io/blog/2019/07/05/1.1.0-M14.html#mirrors

@olafurpg
Copy link
Member

Cool, so are you planning to fix this ?
anybody is working on this ?
just wondering if anybody got chance to fix this ?..
actually long time waiting for this so that i can use it ?

@rajeshK88 Repeatedly asking maintainers when they are going to fix your issue is not good behavior. If this issue is important to you then you should consider contributing a fix instead.

@rajeshK88
Copy link
Author

@rajeshK88 What happens if you configure a Maven mirror as described here? https://get-coursier.io/blog/2019/07/05/1.1.0-M14.html#mirrors

that also did not work..

@rajeshK88
Copy link
Author

rajeshK88 commented Sep 13, 2019

Cool, so are you planning to fix this ?
anybody is working on this ?
just wondering if anybody got chance to fix this ?..
actually long time waiting for this so that i can use it ?

@rajeshK88 Repeatedly asking maintainers when they are going to fix your issue is not good behavior. If this issue is important to you then you should consider contributing a fix instead.

Sorry about that.. I was just trying to follow up but i realized now that, i should not do that as it is not priority for maintainers.. will be careful next time..

@gabro
Copy link
Member

gabro commented Sep 13, 2019

Sorry about that.. I was just trying to follow up but i realized now that, i should not do that as it is not priority for maintainers.. will be careful next time..

To clarify: it's perfectly ok to follow up and provide additional information.

What's not so ok is repeatedly asking maintainers to work on something. We're all committed in evolving Metals, but this particular issue simply hasn't been a priority so far.

Thanks for understanding 🙏

@rajeshK88
Copy link
Author

Sorry about that.. I was just trying to follow up but i realized now that, i should not do that as it is not priority for maintainers.. will be careful next time..

To clarify: it's perfectly ok to follow up and provide additional information.

What's not so ok is repeatedly asking maintainers to work on something. We're all committed in evolving Metals, but this particular issue simply hasn't been a priority so far.

Thanks for understanding 🙏

All right sure.. as i said will be careful next time !!!

@gavares
Copy link

gavares commented Nov 9, 2020

I lost the better part of an hour dealing with the same issue described above. For anyone else coming across this, configuring ~/.config/coursier/mirror.properties like:

jcenter.from=https://repo1.maven.org/maven2
jcenter.to=https://artifactory.mycomany.com/maven2

typesafe.from=https://repo.typesafe.com/typesafe/ivy-releases
typesafe.to=https://artifactory.mycompany.com/typesafe-ivy-releases/

resolved the issue for me.

Notice I had to add both repositories in my case because of the way the company has setup artifactory. The key is to keep adding mirror entries until you've fixed each resolve error. You can find out what the repos are named like typesafe.from|to by matching failing resolution urls to names in Repositories.scala

@tgodzik
Copy link
Contributor

tgodzik commented Nov 9, 2020

@gavares Sorry about that, working with proxies and private repositories is not yet resolved very well. We've put some more information into https://scalameta.org/metals/docs/build-tools/proxy.html, but that might not be enough.

@gavares
Copy link

gavares commented Nov 9, 2020

@tgodzik , not a problem. Hopefully my comment will help others in the future. It didn't help that there are so many moving parts where things can fail: VSCode, SSH, Proxy, Metals, Bloop, Coursier, Mirror Repos. Most of my time was spent tracking the issue down. Once I got to coursier, it was pretty easy to figure out.

One thing that might help is adding something to the effect of my last paragraph in my comment above about how to figure out what the repos are named and how to map them appropriately.

kasiaMarek pushed a commit to kasiaMarek/metals-vscode that referenced this issue Mar 29, 2023
…rn/types/node-14.0.9

Bump @types/node from 14.0.6 to 14.0.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants