In short, I want to have a command ("publish-snapshot"), which would run a "publish" task with modified "version" setting (that setting is to be computed at the time of execution of the command).
I figured out how to get current value of the version inside command, and Project.runTask(<task>, <scope>, ...) seems to be a right call for invoking that publish task.
The only thing that I'm confused with is how to modify the State instance with a new version value. All my attempts seem to do nothing to the original version setting. I posted my latest attempt -
http://pastebin.com/DAGfMQEa .
Is there some way to fix that behavior?