sbt / sbt-maven-resolver

An sbt plugin to resolve dependencies using Aether
12 stars 9 forks source link

the Aether Maven resolver does not handle transitive dependencies specified with a maven version range expression #4

Open dpratt opened 9 years ago

dpratt commented 9 years ago

In the example below, it looks like Ivy is trying to resolve joda-time:joda-time:[2.2,). The version in the moduleid appears to be a legal Ivy version range expression, but Ivy still chokes on it.

build.sbt

organization := "com.test"
name := "maven-version-range-bug"
version := "1.0.0-SNAPSHOT"
scalaVersion := "2.11.6"
libraryDependencies += "com.amazonaws" % "aws-java-sdk" % "1.7.8.1"

project/plugins.sbt

addMavenResolverPlugin

Running the above project gives the following output -

info] Loading global plugins from /Users/dpratt/.sbt/0.13/plugins
[info] Loading project definition from /Users/dpratt/sbt-resolve-bug/project
[info] Set current project to maven-version-range-bug (in build file:/Users/dpratt/sbt-resolve-bug/)
[info] Updating {file:/Users/dpratt/sbt-resolve-bug/}sbt-resolve-bug...
[info] Resolving jline#jline;2.12.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: joda-time#joda-time;[2.2,): Illegal character in path at index 20: joda-time/joda-time/[2.2,)/joda-time-[2.2,).pom
jsuereth commented 9 years ago

Yeah, this is a known issue in the current resolver, although I did think transitive dependencies would work. I'll have to prioritize the version range query.

jsuereth commented 9 years ago

@dpratt I think I have a fix I've just pushed. ANy chance you could try it out locally?

dpratt commented 9 years ago

I'll have a look right now.

dpratt commented 9 years ago

I'm sad to report that this still appears to be broken - here's the output I get when running it on my project

[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.1 ...
[info] Done updating.
[info] Resolving joda-time#joda-time;[2.2,) ...
[warn] problem while listing resources in https://artifactory.vast.com/ivy/joda-time/joda-time/ with vast-artifactory-ivy:
[warn]   java.lang.NullPointerException charsetName
[warn] problem while listing resources in https://artifactory.vast.com/ivy/joda-time/joda-time/ with artifactory-ivy:
[warn]   java.lang.NullPointerException charsetName
[info] Resolving jline#jline;2.12.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: joda-time#joda-time;[2.2,): several problems occurred while resolving dependency: joda-time#joda-time;[2.2,) {compile=[compile(*), master(compile)], runtime=[runtime(*)]}:
[warn]  Illegal character in path at index 20: joda-time/joda-time/[2.2,)/joda-time-[2.2,).jar
[warn]  Illegal character in path at index 20: joda-time/joda-time/[2.2,)/joda-time-[2.2,).jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      joda-time:joda-time:[2.2,)
[warn]        +- com.amazonaws:aws-java-sdk:1.7.8.1 (/Users/dpratt/code/homestory/homestory-api/common/build.sbt#L4-26)
[warn]        +- com.vast.homestory:common:1.1.0-SNAPSHOT
dpratt commented 9 years ago

To eliminate external variables, I've also changed my global sbt config to not override the default list of repositories and resolvers, and I've cleared out ~/.ivy2/maven-cache and ~/.sbt/0.13/dependency. Running the sample project gives me

Sauron:sbt-resolve-bug dpratt$ xsbt
[info] Loading global plugins from /Users/dpratt/.sbt/0.13/plugins
[info] Loading project definition from /Users/dpratt/sbt-resolve-bug/project
[info] Set current project to maven-version-range-bug (in build file:/Users/dpratt/sbt-resolve-bug/)
> about
[info] Updating {file:/Users/dpratt/sbt-resolve-bug/}sbt-resolve-bug...
[info] Resolving joda-time#joda-time;[2.2,) ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: joda-time#joda-time;[2.2,): Illegal character in path at index 20: joda-time/joda-time/[2.2,)/joda-time-[2.2,).jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      joda-time:joda-time:[2.2,)
[warn]        +- com.amazonaws:aws-java-sdk:1.7.8.1 (/Users/dpratt/sbt-resolve-bug/build.sbt#L9-10)
[warn]        +- com.test:maven-version-range-bug_2.11:1.0.0-SNAPSHOT
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: joda-time#joda-time;[2.2,): Illegal character in path at index 20: joda-time/joda-time/[2.2,)/joda-time-[2.2,).jar
[info] This is sbt 0.13.9-SNAPSHOT
[info] The current project is {file:/Users/dpratt/sbt-resolve-bug/}sbt-resolve-bug 1.0.0-SNAPSHOT
[info] The current project is built against Scala 2.11.6
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.MavenResolverPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4
> 
eed3si9n commented 9 years ago

sbt/sbt#1944 did not fix this bug. I figured if Travis passed on one of two builds, it would be ok:

but apparently not. Both on my Mac and Ubuntu, running the following still breaks:

> mavenResolverPluginTest:scripted dependency-management/transitive-version-range
jsuereth commented 9 years ago

@eed3si9n Quick question, are you seeing the same error message about encoding?

I think we may need to force an encoding somewhere....