sbt/librarymanagement

Difference between Resolver.url & `"foo" at "https://.."`

dwijnand opened this issue · 8 comments

I was reminded to today by @SethTisue of this issue which doesn't seem to have been already reported: there's a different between

Resolver.url("foo", new URL("http://example.org/foo/"))(Resolver.mavenStylePatterns)

and

"foo" at "https://example.org/foo/"

same with Resolver.file and "foo" at "file://.." (see sbt/sbt#4015)

How is this a bug? The documentation (https://www.scala-sbt.org/1.x/docs/Resolvers.html) says:

Maven

Resolvers for Maven2 repositories are added as follows:

resolvers += 
 "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

how is it not a bug? in both cases you're trying to define a resolver for a maven repository. why does one work and the other not?

also note that the very same page you link says:

These are basic examples that use the default Maven-style repository layout.
[...]

URL

Define a URL repository at "https://example.org/repo-releases/".

resolvers += Resolver.url("my-test-repo", url("https://example.org/repo-releases/"))

(https://www.scala-sbt.org/1.x/docs/Resolvers.html#URL)

Resolver.url defines an Ivy repository.

where is that stated?

the type signature states it defines a URL repository. it accepts patterns of which there is a mavenStylePatterns, which also the defaultPatterns and the implicit Patterns value in implicit scope.

Custom

sbt provides an interface to the repository types available in Ivy: file, URL, SSH, and SFTP.

There's more to Maven emulation than layout internal to both sbt and Ivy.

There's more to Maven emulation than layout internal to both sbt and Ivy.

where is that stated?

this is way to easy to do wrong and the fact that it's wrong is not obvious.

Not sure if these implementation details are stated but there are things like sbt/sbt#2172 and more stuff on the Ivy side.