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 not resilient to changing local ivy cache directory #665

Closed
Mocuto opened this Issue Sep 23, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Mocuto
Contributor

Mocuto commented Sep 23, 2017

For resolving local cached dependencies, Coursier assumes they're in the $user.home/.ivy directory, even though that is absolutely not guaranteed.

See the following lines in Cache.scala:


  private lazy val ivy2HomeUri = {

    // a bit touchy on Windows... - don't try to manually write down the URI with s"file://..."

    val str = new File(sys.props("user.home") + "/.ivy2/").toURI.toString

    if (str.endsWith("/"))

      str

    else

      str + "/"

  }

It's very likely that a user may change their ivy home location via the SBT options:


-Dsbt.ivy.home=D:/mocut/.ivy2/

-Divy.home=D:/mocut/.ivy2/

Thus, Coursier should try sys.props("ivy.home") or sys.props("sbt.ivy.home") before deferring to sys.props("user.home")

@alexarchambault

This comment has been minimized.

Show comment
Hide comment
@alexarchambault

alexarchambault Sep 27, 2017

Member

It shouldn't be an issue when using coursier from sbt, as the ivy2 local repository comes from sbt itself, not from coursier.Cache.ivy2Local. The right Java properties should already be handled fine thanks to that.

It can only be a problem when using coursier via its API (and using directly coursier.Cache.ivy2Local), or from the CLI of coursier.

I'd be happy to merge a PR taking into account the ivy.home property for coursier.Cache.ivy2*.

Member

alexarchambault commented Sep 27, 2017

It shouldn't be an issue when using coursier from sbt, as the ivy2 local repository comes from sbt itself, not from coursier.Cache.ivy2Local. The right Java properties should already be handled fine thanks to that.

It can only be a problem when using coursier via its API (and using directly coursier.Cache.ivy2Local), or from the CLI of coursier.

I'd be happy to merge a PR taking into account the ivy.home property for coursier.Cache.ivy2*.

@alexarchambault

This comment has been minimized.

Show comment
Hide comment
@alexarchambault

alexarchambault Dec 11, 2017

Member

Fixed by #705.

Member

alexarchambault commented Dec 11, 2017

Fixed by #705.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment