August 2013
Intermediate to advanced
720 pages
16h 23m
English
You’ve created a Scala project or library with SBT that you want to share with other users, creating all the files you need for an Ivy repository.
Define your repository information, then publish your project with
sbt publish or sbt publish-local.
For my SoundFilePlayer library, I added this setting to my build.sbt file to define the location of my local repository:
publishTo := Some(Resolver.file("file", new File("/Users/al/tmp")))I then ran sbt publish, and SBT
generated the following files:
$ sbt publish
[info] Wrote
/Users/al/SoundFilePlayer/target/scala-2.10.0/sounds_2.10.0-1.0.pom
[info] :: delivering :: default#sounds_2.10.0;1.0 :: 1.0 :: release ::
[info] delivering ivy file to
/Users/al/SoundFilePlayer/target/scala-2.10.0/ivy-1.0.xml
[info] published sounds_2.10.0 to
/Users/al/tmp/default/sounds_2.10.0/1.0/sounds_2.10.0-1.0.pom
[info] published sounds_2.10.0 to
/Users/al/tmp/default/sounds_2.10.0/1.0/sounds_2.10.0-1.0.jar
[info] published sounds_2.10.0 to
/Users/al/tmp/default/sounds_2.10.0/1.0/sounds_2.10.0-1.0-sources.jar
[info] published sounds_2.10.0 to
/Users/al/tmp/default/sounds_2.10.0/1.0/sounds_2.10.0-1.0-javadoc.jar
[success] Total time: 1sWithout doing anything to define a “local Ivy repository,” I get
the following results when running the publish-local task:
$ sbt publish-local [info] Wrote /Users/al/SoundFilePlayer/target/scala-2.10.0/sounds_2.10.0-1.0.pom [info] :: delivering :: default#sounds_2.10.0;1.0 :: 1.0 :: ...Read now
Unlock full access