Invertability Of Local Publication And Resolution

50 views
Skip to first unread message

Ray Racine

unread,
May 1, 2012, 2:13:48 PM5/1/12
to simple-b...@googlegroups.com
Hi, been away for a long time.

publish-local and update (which attempts to resolve from the local repository) don't seem to share the same default pattern.  I've always worked around this by manually setting patterns but it seems a bit inefficient.

Example.

Create a tiny project Hello with build.sbt as follows: 

name := "hello"

version := "1.0"

organization := "ray"

Publish said project via publish-local.

sbt> publish-local
...
[info] published hello_2.9.1 to /home/ray/.ivy2/local/ray/hello_2.9.1/1.0/jars/hello_2.9.1.jar
[info] published ivy to /home/ray/.ivy2/local/ray/hello_2.9.1/1.0/ivys/ivy.xml
...

Now lets pretend we want to use the above published local artifact as a standard sbt dependency.

An equally simple sbt.build of a project which uses hello.jar

name := "main"

version := "1.0"

organization := "ray"

libraryDependencies += "ray" % "hello" % "1.0"

sbt> update

Resolving ray#hello;1.0 ...
[warn] module not found: ray#hello;1.0
[warn] ==== local: tried
[warn]   /home/ray/.ivy2/local/ray/hello/1.0/ivys/ivy.xml
...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] ::          UNRESOLVED DEPENDENCIES         ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ray#hello;1.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/tmp/p1/}default-df7991/*:update: sbt.ResolveException: unresolved dependency: ray#hello;1.0: not found

The out-of-the-box sbt local publish pattern does not match the out-of-box sbt local resolution pattern.

[info] published ivy to /home/ray/.ivy2/local/ray/hello_2.9.1/1.0/ivys/ivy.xml
[warn]       (resolving from)  /home/ray/.ivy2/local/ray/hello/1.0/ivys/ivy.xml

Can we bring the "default" local pattern for publish/resolution into alignment?


Thanks,

Ray

Christian Goetze

unread,
May 1, 2012, 7:14:50 PM5/1/12
to simple-b...@googlegroups.com
would using "ray" %% "hello" % "1.0" help?

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/D3sTOLKCezAJ.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

Ray Racine

unread,
May 3, 2012, 2:29:44 PM5/3/12
to simple-b...@googlegroups.com
Yes '%%' does work and much simpler then my previous work around of using custom patterns.    However, in the general case SBT vanilla out of the box, should be able to a) publish a jar to the local repository and then in turn be able to subsequently retrieve/use it.

I'll open it as a low priority bug.

Thanks for the simpler '%%'.

Ray

Robin Green

unread,
May 4, 2012, 4:54:57 AM5/4/12
to simple-b...@googlegroups.com
I don't think this is a bug at all! It's just that you need to use %% for Scala libraries published with the sbt naming convention, and % for all other dependencies. Otherwise sbt would not know which naming convention to use. The naming convention, in turn, is needed because of binary incompatibilities between certain Scala versions, necessitating building multiple binary versions of the same source code.

It's fairly arbitrary which symbol was chosen to mean which, but there is actually a valid reason, namely that at present, the majority of dependencies available in the world are probably of the % variety, not the %% variety, so it saves keystrokes.
Ray

To post to this group, send email to simple-build-tool@googlegroups.com.
To unsubscribe from this group, send email to simple-build-tool+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To post to this group, send email to simple-build-tool@googlegroups.com.
To unsubscribe from this group, send email to simple-build-tool+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages