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

If using interactive sbt console, version only gets regenerated on reload #31

Closed
lukens opened this issue Jan 15, 2014 · 5 comments
Closed

Comments

@lukens
Copy link

lukens commented Jan 15, 2014

I tend to work in an interactive sbt console, however, this does not regenerate the version number unless you reload.

Is there a way to have these regenerated whenever a task is run?

@jsuereth
Copy link
Member

No :(. version in sbt is a "Setting" which means it's only generated on load/reload.

I recommend making a release script which will ensure a reload/cleaned project.

commands += Command.command("release") { state =>
   "reload" :: "test" :: "publishSigned" :: state
}

@lukens
Copy link
Author

lukens commented Jan 15, 2014

Thanks, I will look at doing something like that.

@aradke
Copy link

aradke commented Sep 25, 2015

I would love to have this automatically be updated too.

In the meantime, instead of using git to directly tag the version, I use sbt to tag and refresh the project. This way sbt will grab then grab the most recent version.

commands += Command.single("tag"){case (state,versionTag) => 
   println(s"Commiting a git annotated tag of v$versionTag, and refreshing the project ")
   s"git tag -a -m v$versionTag v$versionTag" :: "reload" ::  state
}

Then using the interactive sbt console to make a tag keeps sbt in sync for future commands:

> tag 0.1.0

However, the version is still not refreshed for local changes until a new tag is made. In this case, a release command that includes the refresh command as suggested by @jsuereth may be better.

@luckyrandom
Copy link

The following commands, which override the default task, work well for me.

Command.command("package") {
    state => {
      println("==== Reload & package ====")
      "reload" :: "compile:package" :: state
    }
  }
Command.command("assembly") {
    state => {
      println("==== Reload & assembly ====")
      "reload" :: "*:assembly" :: state
    }
  }

@dwijnand
Copy link
Member

I would love this too. But version isn't going to become a task.

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

No branches or pull requests

5 participants