On Tue, 19 Jun 2012 12:15:36 -0700 (PDT)
Michael Klishin <
michael....@gmail.com> wrote:
> Hi!
>
> I am one of the
travis-ci.org core team members and we are looking to speed
> up dependency installation for Scala
> projects that use SBT. We have a few Maven mirrors and ~/.m2/settings.xml
> that makes projects use them without
> changing anything in their pom files. I am looking into doing something
> similar for SBT and a little stuck.
0.12.0, which is on RC2 right now, has support for overriding the repositories. This is probably the most reliable and straightforward way, but it obviously only works for 0.12 and later. From the 0.12 documentation (unpublished):
### Override all resolvers for all builds
The repositories used to retrieve sbt, Scala, plugins, and application dependencies can be configured globally and declared to override the resolvers configured in a build or plugin definition.
There are two parts:
1. Define the repositories used by the launcher.
2. Specify that these repositories should override those in build definitions.
The repositories used by the launcher can be overridden by defining `~/.sbt/repositories`, which must contain a `[repositories]` section with the same format as the [[Launcher]] configuration file. For example:
[repositories]
local
my-maven-repo:
http://example.org/repo
my-ivy-repo:
http://example.org/ivy-repo/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
A different location for the repositories file may be specified by the `sbt.repository.config` system property in the sbt startup script.
The final step is to set `sbt.override.build.repos` to true to use these repositories for dependency resolution and retrieval.
> This documentation page suggest there is a way to configure SBT globally:
>
>
https://github.com/harrah/xsbt/wiki/Global-Settings
>
> but then it mentions ~/.sbt/.sbt and ~/.sbt/global.sbt. Which one should I
> use? Is it a typo in the docs?
I updated the text. Is it clearer now?
> Another thing it does not explain is how to configure resolvers via that
> file and if it is the same as build.sbt, how the settings
> are merged with project-specific ones.
They are the same settings, but you would probably want to override fullResolvers. Users shouldn't normally touch fullResolvers, so the precedence shouldn't matter.
> Am I looking in the right direction? Is there a better way? Do we
> absolutely have to proxy Ivy repositories or
> just proxying common Maven ones would be sufficient? What repositories we
> should proxy?
With the default repositories, sbt will pull Scala and its dependencies from Maven central. sbt itself comes from
http://repo.typesafe.com/typesafe/ivy-releases/ (an Ivy repository).
Several sbt plugins are hosted on
http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/ (also an Ivy repository).
For snapshots, sbt comes from
http://repo.typesafe.com/typesafe/ivy-releases/ and Scala comes from Sonatype's OSS repository
https://oss.sonatype.org/content/repositories/snapshots.
As for proxying, it sounds like users have not had success getting Nexus (I am assuming you are using Nexus or a custom solution if you are concerned about Ivy repositories being a problem) to mirror the Ivy repositories properly, although I believe Sonatype has indicated it should in theory work (I may be incorrectly remembering the details of what exactly works).
> The goal is to make SBT use our mirrors by default, so that projects we
> host won't have to
> tweak their settings. We build our own Debian packages of SBT [1], so
> bundling property files and similar approaches will
> be considered, too.
Once sbt and Scala are retrieved, sbt copies them to its "boot" directory. This is by default in ~/.sbt/boot in 0.11 and later. One option is to point projects at this boot directory and make it read-only and shared. This is usually used by organizations locked to a fixed/controlled number of Scala/sbt versions and is probably not too useful for you if you need to support arbitrary sbt and Scala versions.
> In case you need to understand better what is Travis CI and what we do,
> take a look at
>
>
http://about.travis-ci.org/
>
http://about.travis-ci.org/docs/user/getting-started/
>
> I am sorry about asking such trivial things but last time I used SBT it was
> at 0.7.
Not a problem at all and unfortunately they haven't really been trivial before Josh submitted the patch that got included in 0.12.0. Let us know if there is anything else that would help you support sbt+Scala better.
-Mark
> Thank you.
>
> MK
>
> --
> 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/-/Vl5Ll5dWpl4J.
> 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.
>