So my general problem is that I want to set the version key based on the result of a task. However the version key is set before the task is run. From what I understand I can't change the value of a key once it is set so I can't change this within my task.
What I want to do is run the task as a dependency to the publish task and change the value for version. I feel like there must be a way to do this, but I have no clues at the moment. Any help would be greatly appreciated.
The sbt-release plugin does this by writing an sbt file in the root of the project containing the correct version. Maybe you can use this plugin: https://github.com/sbt/sbt-release
If you can not use it you can check out the source code to see the strategy the creator used.
来源:https://stackoverflow.com/questions/26411801/sbt-run-task-to-set-a-settingkey