我正在尝试基于git提交创建版本号,但是当我运行gradle时,我一直收到以下错误(这是在build.gradle文件中)
ext {
// Get version number and build number
def gitNum = "git rev-list --count master".execute().text.trim()
def version = (gitNum / 10)
def build = (gitNum.toInterger % 10)
}
错误:
No signature of method: java.lang.String.div() is applicable for argument types:
(java.lang.Integer) values: [10] Possible solutions:
is(java.lang.Object), drop(int), wait(), trim(), dump(), any()
答案 0 :(得分:1)
我认为这就是你想要的。
def gitNum = "git rev-list --count master".execute().text.trim().toInteger()