Skip to content

Conversation

@szeiger
Copy link
Contributor

@szeiger szeiger commented Sep 14, 2016

If the JLine dependency is resolved through Ivy instead of Maven (which
can happen with a local proxy setup in sbt that funnels all artifacts
through an Ivy repo), the artifact may have a “configuration” set,
which prevents a naive comparison of ModuleIDs from finding it.

@mgttlinger ran into this issue during the Typelevel Workshop at Scala World.

If the JLine dependency is resolved through Ivy instead of Maven (which can happen with a local proxy setup in sbt that funnels all artifacts through an Ivy repo), the artifact may have a “configuration” set, which prevents a naive comparison of ModuleIDs from finding it.
@scala-jenkins scala-jenkins added this to the 2.12.1 milestone Sep 14, 2016
@mgttlinger
Copy link

For reference: I ran into this because I use coursier (http://get-coursier.io/) for dependency resolution instead of the built in resolver in sbt.

/** Find a specific module's JAR in a classpath, comparing only organization and name */
def findJar(files: Seq[Attributed[File]], dep: ModuleID): Option[Attributed[File]] = {
def extract(m: ModuleID) = (m.organization, m.name)
files.find(_.get(moduleID.key).map(extract _) == Some(extract(dep)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some(extract(dep)) could be stored in a local instead of re-creating it over again

@lrytz
Copy link
Member

lrytz commented Sep 16, 2016

LGTM

@szeiger szeiger merged commit 63f5eb5 into scala:2.12.x Sep 21, 2016
@szeiger szeiger deleted the wip/ignore-jline-configs branch September 21, 2016 17:31
@dwijnand
Copy link
Member

dwijnand commented Sep 21, 2016

Comparing ModuleId's with == isn't very reliable.

I improved the situation a little for sbt 1.0 https://github.com/sbt/librarymanagement/pull/48/files

It was working before this change before because JLine is a java dependency, so is defined with CrossVerison.Disabled, which is an object - no function to mess things up.

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

Labels

None yet

5 participants