SBT - 运行任务以设置 SettingKey [英] SBT - Run Task to set a SettingKey

查看:40
本文介绍了SBT - 运行任务以设置 SettingKey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我的一般问题是我想根据任务的结果设置版本密钥.但是,版本密钥是在任务运行之前设置的.据我所知,一旦设置了密钥,我就无法更改它的值,因此我无法在我的任务中更改它.

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.

推荐答案

sbt-release 插件通过在包含正确版本的项目根目录中写入 sbt 文件来实现此目的.也许你可以使用这个插件:https://github.com/sbt/sbt-release

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.

这篇关于SBT - 运行任务以设置 SettingKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆