document the fact that project/build.properties file gets created
See original GitHub issueproblem
The behavior of sbtVersion
is inconsistent. The help text states, “Provides the version of sbt. This setting should not be modified.” But the actual behavior is:
- In an SBT project with no project/build.properties file:
- It creates a project/build.properties file with the version of the current SBT executable
- It reports the SBT version it wrote in that file
- In an SBT project with an existing project/build.properties file:
- It reports the SBT version in project/build.properties file
- In my HOME directory:
- It creates a project directory and project/build.properties file
- In an empty directory:
- It reports the version of the SBT executable
steps
The following examples show the issue(s).
(1) Move into an existing SBT project that has no project/build.properties file
/Users/al/Projects/Scala/CatoGui> sbt sbtVersion
[info] Updated file /Users/al/Projects/Scala/CatoGui/project/build.properties:
set sbt.version to 1.2.6
Results:
- It creates a project/build.properties file with the version of the current SBT executable
- It reports the SBT version it wrote in that file
(2) Move into an SBT project that has an existing project/build.properties file
In this example, project/build.properties already has sbt.version=1.1.1
:
> sbt sbtVersion
[info] Loading settings from idea.sbt ...
[info] Loading global plugins from /Users/al/.sbt/1.0/plugins
[info] Loading project definition from /Users/al/Projects/Scala/Tmp/project
[info] Updating ProjectRef(uri("file:/Users/al/Projects/Scala/Tmp/project/"), "tmp-build")...
[info] Done updating.
[info] Loading settings from build.sbt ...
[info] Set current project to Tmp (in build file:/Users/al/Projects/Scala/Tmp/)
[info] 1.1.1
Results:
- It reports the SBT version in project/build.properties file
(3) In my HOME directory, it creates a project directory and project/build.properties file
This is the behavior in my HOME directory:
/Users/al> sbt sbtVersion
[info] Updated file /Users/al/project/build.properties: set sbt.version to 1.2.6
[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from /Users/al/.sbt/1.0/plugins
[info] Loading project definition from /Users/al/project
[info] Updating ProjectRef(uri("file:/Users/al/project/"), "al-build")...
[info] Done updating.
[info] Set current project to al (in build file:/Users/al/)
[info] 1.2.6
Results:
- It creates a project/build.properties file under my HOME directory with the version of the current SBT executable
- It reports the SBT version it wrote in that file
(4) In an empty directory, it reports the version of the SBT executable
This is the behavior in a non-SBT directory that is not my HOME directory:
/Users/al/tmp> sbt sbtVersion
[warn] No sbt.version set in project/build.properties, base directory: /Users/al/tmp
[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from /Users/al/.sbt/1.0/plugins
[info] Set current project to tmp (in build file:/Users/al/tmp/)
[info] 1.2.6
Results:
- It reports the version of the
sbt
executable (without creating a project directory)
expectation
- Per the help text, I expect it to report the current version of SBT, and it should not write or overwrite project/build.properties.
- Also, it’s not clear whether the version that is reported should be the version of (a) the
sbt
executable installed on my system, or (b) the version of SBT that’s configured in project/build.properties of the current project, assuming I’m in an SBT project directory. It seems like these are two different requests that require different commands.
notes
sbt version: 1.2.6 (installed on MacOS with Homebrew)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
POM Reference - Maven
Introduction. The POM 4.0.0 XSD and descriptor reference documentation ... It is an XML representation of a Maven project held in a file...
Read more >buildmetadata-maven-plugin - Usage - smartics
The file buildmetadata.properties is written to the META-INF folder by default. ... The properties file is created per default in the META-INF folder...
Read more >Spring Boot: Is it possible to use external application ...
After the jar file had been built, I could see that the PropertiesLauncher is used by inspecting Main-Class property in META-INF/MENIFEST.
Read more >sbt Reference Manual — Build definition
To do this, create a file named project/build.properties that specifies the sbt version as follows: sbt.version=1.8.0. If the required version is not ...
Read more >MSBuild reference for .NET SDK projects - Microsoft Learn
PublishDocumentationFile. When this property is true , the XML documentation file for the project, if one is generated, is included in the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your help on this!
The
sbt name
part is also surprising. Maybe a way to describe this is that as a user I feel like I’m issuing a SQL SELECT query when I runsbtVersion
orname
, but under certain circumstances it also runs an INSERT as a side effect. If that’s the way it’s supposed to work, no problem, I just thought it was a bug.