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

Print a warning if sbt.version is not defined in the project/build.properties #754

Closed
OlegYch opened this issue May 10, 2013 · 7 comments
Closed

Comments

@OlegYch
Copy link
Contributor

OlegYch commented May 10, 2013

This would help creating more reproducible builds.

@SethTisue
Copy link
Member

this'd be great. I often run into people who aren't aware this is recommended practice. there are also people who are aware, but never quite get around to adding the version, and a nudge from a warning would help.

@jsuereth jsuereth changed the title Print a warning if sbt.version is not defined in the project Print a warning if sbt.version is not defined in the project/build.properties Aug 8, 2014
@jsuereth jsuereth modified the milestones: 1.0, 0.13.7 Aug 8, 2014
@eed3si9n eed3si9n modified the milestone: 0.13.7 Nov 4, 2014
@dwijnand dwijnand self-assigned this Jul 12, 2016
@eed3si9n
Copy link
Member

We should just create one automatically if it's not there at startup.

@eed3si9n eed3si9n added this to the 1.0.0 milestone Jul 12, 2016
@dwijnand
Copy link
Member

@eed3si9n Sure, but only after being prompted. Otherwise we run the risk of creating build.properties files in random locations when the user is in the wrong directory (eg. in src/).

@dwijnand
Copy link
Member

dwijnand commented Mar 7, 2017

sbt new is the exception to the rule.

@dwijnand
Copy link
Member

Ok, so to mitigate accidental file creation we can use sbt-extras' algorithm: the presence of a .sbt file at the root or a 'project' directory at the root.

@dwijnand
Copy link
Member

Silently create the file.

@dwijnand
Copy link
Member

If there's no sbt.version, no *.sbt file and no project directory, e.g you accidentally started sbt in /tmp, warn and continue, in both 0.13 and 1.0.

dwijnand added a commit to dwijnand/sbt that referenced this issue Mar 16, 2017
Have sbt.version set in project/build.properties is a best practice
because it makes the build more deterministic and reproducible.

With this change sbt, after ensuring that the base directory is probably
an sbt project, writes out sbt.version in project/build.properties if it
is missing.

Fixes sbt#754
eed3si9n pushed a commit to eed3si9n/sbt that referenced this issue Apr 4, 2017
Have sbt.version set in project/build.properties is a best practice
because it makes the build more deterministic and reproducible.

With this change sbt, after ensuring that the base directory is probably
an sbt project, writes out sbt.version in project/build.properties if it
is missing.

Fixes sbt#754
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

6 participants