Coursier: COURSIER_INSTALL_DIR does not work as advertised

Created on 13 Mar 2020  路  3Comments  路  Source: coursier/coursier

it seems neither COURSIER_INSTALL_DIR nor COURSIER_BIN_DIR are taken into consideration.

  • coursier : 2.0.0-RC6-10
  • java "1.8.0_162"
  • macOS mojave 10.14.6
oliviermelois@OM-WXRG8WN-MBP:/tmp$ cs --help
Coursier 2.0.0-RC6-10
Usage: cs [options] [command] [command-options]

Available commands: bootstrap, complete, fetch, install, java, java-home, launch, publish, resolve, setup, uninstall, update

Type  cs command --help  for help on an individual command


oliviermelois@OM-WXRG8WN-MBP:/tmp$ COURSIER_INSTALL_DIR=/tmp/random_dir/ cs install ammonite
https://repo1.maven.org/maven2/com/lihaoyi/ammonite_2.13.1/maven-metadata.xml
  No new update since 2020-01-14 04:26:58
Warning: /Users/oliviermelois/Library/Application Support/Coursier/bin is not in your PATH
To fix that, add the following line to ~/.bashrc

export PATH="$PATH:/Users/oliviermelois/Library/Application Support/Coursier/bin"
bug

All 3 comments

I create a pull request can solve this problem, https://github.com/coursier/coursier/pull/1672.
@alexarchambault , if you have some time, please have a look at it.

I think the problem will be more serious. For some application such as almond on mac.
For mac the default dir is ~/Library/Application Support/Coursier/bin.
And it has a space in Application Support, when I run almond --install, it will report a exception

./almond --install
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 41: file:///Users/myuser/Library/Application Support/Coursier/bin/almond
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3053)
    at java.net.URI.<init>(URI.java:588)
    at almond.kernel.install.Install$.$anonfun$currentAppCommand$1(Install.scala:143)
    at scala.Option.map(Option.scala:242)
    at almond.kernel.install.Install$.currentAppCommand(Install.scala:138)
    at almond.kernel.install.Install$.install(Install.scala:231)
    at almond.kernel.install.Install$.installOrError(Install.scala:280)
    at almond.ScalaKernel$.run(ScalaKernel.scala:46)
    at almond.ScalaKernel$.run(ScalaKernel.scala:15)
    at caseapp.core.app.CaseApp.$anonfun$main$2(CaseApp.scala:68)
    at caseapp.core.app.CaseApp.$anonfun$main$2$adapted(CaseApp.scala:68)
    at scala.util.Either.fold(Either.scala:189)
    at caseapp.core.app.CaseApp.main(CaseApp.scala:68)
    at almond.ScalaKernel.main(ScalaKernel.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at coursier.bootstrap.launcher.a.a(Unknown Source)
    at coursier.bootstrap.launcher.Launcher.main(Unknown Source)

@zheh12 That can probably be fixed around here in almond. The content of coursier.mainJar is created around here, so there must be a way to make that more stable.

Was this page helpful?
0 / 5 - 0 ratings