How to proxy a static snapshot of scala 2.10.3 - scala

Scala 2.10.3 has a bug fix my team needs; but, I don't want to subject my group to a constantly changing version (using 2.10.3-SNAPSHOT). How can I download the latest snapshot, publish it to my local nexus (say 2.10.3-FOO) and have sbt use it? I'm familiar with proxy-ing and did get sbt to use our nexus repository to download the renamed scala-lang, scala-compiler. However, it never downloads scala-reflect and bombs out. What am I missing?

I found that pulling down scala.git and publishing a local build to our nexus repo using the ant tasks provided allowed me to accomplish what I was after. In terms of sbt, the documented way of using a proxy repo (-Dsbt.override.build.repos=true, using the repositories file) worked well.

Related

SBT : Auto versioning of artifacts

We have a Scala project which we are building via CI tool (TeamCity/Jenkins). We are looking for an ability to set the build version of the artifact from the build job itself and not depend on the entry in build.sbt file. To give a reference, for java maven builds we can use goal set-version where the artifact version is set, irrespective of what we have in pom.xml. we are looking for something similar for a SBT build as well.
I'd reccoment to take a look at next sbt plugins:
https://github.com/dwijnand/sbt-dynver
https://github.com/sbt/sbt-git
Our team uses sbt-dynver to create version from Git, because it is easier. I'd recommend to build version on top of git tags information rather then using CI tool (TeamCity/Jenkins) information - like build number, because you can build same version twice for instance.
Also, consider using https://github.com/sbt/sbt-buildinfo - additionally, so to expose build version though API or print to output to quick identify currently deployed app version.
This isn't really the right forum for this kind of recommendation, but you could start by looking a sbt-git which will set version numbers based on GIT tags.
One option your have, is to add this to your build.sbt:
version := sys.env.getOrElse("ARTIFACT_VERSION", "0.0.0-SNAPSHOT")
Then setting the version you want at the environment variable ARTIFACT_VERSION.

Publishing / Resolving Custom SBT Plugins with Nexus

I've created my first SBT (1.x) AutoPlugin to add some settings and behavior to projects that use the plugin.
When I publish it locally, everything resolves and works correctly for the projects using the plugin.
However, when I publish the plugin to our private Nexus repository, it fails to resolve for any projects attempting to use it.
I realize that when sbt plugins are published locally, the path is different than 'regular' sbt projects, but they still resolve correctly for projects which use them.
Do I need to publish sbt plugins to a different location within Nexus than our other Scala / SBT-based projects?
And / or, do I need to set up a new resolver for Nexus-hosted SBT plugins?
I know similar questions have been asked previously, but being new to both Nexus and plugin creation, I haven't been able to figure out exactly what I need to do to get the plugin to resolve correctly when publishing to Nexus rather than simply doing a publishLocal and then adding it to the plugins.sbt file of projects meant to use the plugin.
Any assistance would be very much appreciated!

Using a library from github not existing in mvn repository

There is a Scala library for redis https://github.com/debasishg/scala-redis. It doesn't exist in mvnrepository.com. It's even not written at github how I must use it (add it as a dependency).
So how do I do that, how do I do add it as a dependency in my project?
If you look at the scala-redis' SBT Project file, it's recorded as redisclient. Searching for the same in maven sonatype, I get this result. Assuming you're using scala-2.10 - if not, you can see the list of released builds for other versions here.

Why SBT custom plugin resolution is slow

I have my custom SBT plugin and I use it in my project. In case of any change of the plugin I make publish-local and then I build my project and sbt writes in console Resolving <my-plugin-name>;0.2-SNAPSHOT .... This resolution takes long time(about minute).
Why it takes so much time to resolve a custom sbt plugin from local repository and how to fix this ?
Update
Please note, that I have slow network connection via proxy-server. So probably it's the issue. But in this case I wonder why sbt needs network if I have my plugin published-local. And if it's the issue how to eliminate network round trip ?
If the dependency is a SNAPSHOT, then sbt will try to resolve it from the remote repository in case it has been updated.
See also Re-download a SNAPSHOT version of a dependency using SBT

Using sbt as a library

sbt has a bunch of nice utils in (e.g.) sbt IO - I'd like to use these in my app. What are the artifact group/names/versions I should be referencing? (This is nearly impossible to Google for...) I looked in scala-tools.org but I could only find 2.7-compatible releases (and I'm building a 2.9 project) - am I out of luck? (For now I might try copying the relevant sources over into my project, if they're easy enough to tease apart and to port to 2.9.)
The groupId is org.scala-sbt as can be seen from https://github.com/harrah/xsbt/blob/0.12.1/project/Sbt.scala but apparently the latest artifacts are not available in a Maven repository. It might be best to build sbt yourself and install it into your local repository, or to just copy the source files into your project. The latest version of sbt (version 0.11) appears to use Scala 2.9.