Currently, I'm using SBT scripted plugin for testing. To publish a plugin into the local repository, following code snippet in build.sbt is used:
crossScalaVersions := Seq(scalaVersion.value,"2.11.7")
scriptedDependencies := {
val local = publishLocal.value
}
This way the artefact gets published into the local repository, but only for the version scalaVersion.value
. I would like to have it cross-published for both scala versions. How can I do that?
To use publishing, you need to specify the repository to publish to and the credentials to use. Once these are set up, you can run publish . The publishLocal action is used to publish your project to your Ivy local file repository, which is usually located at $HOME/. ivy2/local/ .
sbt resolver is the configuration for repository that contains jars and their dependencies. for example the below is a resolver definition for a repository called Sonatype and it points at snapshot releases (dev versions) resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
sbt is a popular tool for compiling, running, and testing Scala projects of any size. Using a build tool such as sbt (or Maven/Gradle) becomes essential once you create projects with dependencies or more than one code file.
As mentioned in the comments by @srjd you can use the +
prefix.
As mentioned in this section of the docs
To build against all versions listed in crossScalaVersions, prefix the action to run with +. For example:
> + test
A typical way to use this feature is to do development on a single Scala version (no + prefix) and then cross-build (using +) occasionally and when releasing.
This works for any action, including publisLocal
.
> + publishLocal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With