Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versions of sub-projects independently #175

Open
pedromss opened this issue Oct 28, 2016 · 12 comments
Open

Versions of sub-projects independently #175

pedromss opened this issue Oct 28, 2016 · 12 comments

Comments

@pedromss
Copy link

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?

@SrikanthTati
Copy link

@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.

@pedromss
Copy link
Author

pedromss commented Aug 8, 2017

Didn't get it to work. Still doing what I mentioned above.

@SrikanthTati
Copy link

I did actually get it to work with releaseVersionFile & releaseUseGlobalVersion. It does read and update version.sbt in subproject. Hope it helps.

@pedromss
Copy link
Author

pedromss commented Aug 8, 2017

What version are you using?

@SrikanthTati
Copy link

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.4")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")

@Leammas
Copy link

Leammas commented Aug 21, 2017

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"

@frne
Copy link

frne commented Oct 2, 2018

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?

@pollycchang
Copy link

pollycchang commented Oct 9, 2018

Yes, your command would just release the root project. To release a specific project, try:

sbt 'project libA' 'release with-defaults'

@vendamere
Copy link

vendamere commented Nov 22, 2019

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.

@bethard
Copy link

bethard commented Apr 4, 2020

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).

@ArinRayAtCornerStoneFS
Copy link

ArinRayAtCornerStoneFS commented Mar 15, 2022

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)

@BusyByte
Copy link

BusyByte commented Jan 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants