SBT - Run Task to set a SettingKey

倖福魔咒の 提交于 2019-12-06 04:12:03

问题


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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!