sbt-release
sbt-release copied to clipboard
Versions of sub-projects independently
Currently I have a root project whose only function is to aggregate several projects in the same git repository.
However the version.value doesn't read the version from the contetnts of version.sbt in each sub-project.
I'm forced to do read(file(s"${name.value}/version.sbt")) in order to get the version contents.
Is there a cleaner way to access the version's of each sub-project?
@pedromss did you get this to work? There is a setting releaseVersionFile that is supposed to do just this but it doesn't seem to be working. All the sub projects seem to have the same version.
Didn't get it to work. Still doing what I mentioned above.
I did actually get it to work with releaseVersionFile & releaseUseGlobalVersion. It does read and update version.sbt in subproject. Hope it helps.
What version are you using?
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.4") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
One more point that worked for me is that you should not write build scope in version.sbt.
version in ThisBuild := "0.1" becomes version := "0.1"
Any news on this? Trying to release several sub-projects with independent version.sbt but not the root project:
build.sbt
lazy val releaseSettings = Seq(
releaseUseGlobalVersion := false,
releaseVersionFile := file(name.value + "/version.sbt"),
releaseTagName := {
val versionInThisBuild = (version in ThisBuild).value
val versionValue = version.value
s"${name.value}-v${if (releaseUseGlobalVersion.value) versionInThisBuild else versionValue}"
}
)
lazy val root = (project in file(".")).
settings(
releaseSettings
).
aggregate(libA, libB, libC)
lazy val libA = project.settings(releaseSettings)
lazy val libB = project.settings(releaseSettings)
lazy val libC = project.settings(releaseSettings)
command:
sbt release with-defaults
This just releases the root project...
Maybe it's just lack of documentation, or an issue with the SBT definition, but i'm not gonna get it to work.
@pedromss @Leammas Can someone provide correct configuration / feedback how to enable it?
Yes, your command would just release the root project. To release a specific project, try:
sbt 'project libA' 'release with-defaults'
Having spent too much time trying to figure this out too, I finally realized an easy mistake to make is to copy the version.sbt file over to the sub-project, which by default contains version in ThisBuild := "...", with in ThisBuild still in the file it makes useGlobalVersion := false ineffective.
I was trying to do something similar, and kept finding that sbt-release would release SNAPSHOT builds even though it had changed version.sbt and tagged the repository with a non-SNAPSHOT version number. I finally debugged my problem to realizing that I had written:
ThisBuild / releaseUseGlobalVersion := false
instead of:
releaseUseGlobalVersion := false
The former still writes version in ThisBuild := ... into the version.sbt files (and resulted in the strange SNAPSHOT-releasing behavior), while the later writes the expected version := ... (and resulted in successful release of independently versioned subprojects).
I found that adding an explicit disable on the release plugin at root level could prevent the release process being run at the root if the intention is to only enable it for some sub-modules
lazy val root = (project in file(".")).disablePlugins(ReleasePlugin)
We got this to work but not like we'd want. We wanted to run it from the root aggregate but it was not working. We ran it from running project to change to a specific module. The problem with this we have as many sbt release commands as we have modules to publish which is not ideal. At minimum the readme should be updated to detail the usage. There is one sentence on this in the README.md and we spent about 2 days for 2-3 developers pairing to get this to work by reading through this thread, looking through the plugin code, and trying things out. It also would be nicer to have a dry run mode to iterate faster and not have to commit and wait for builds.