I have a below task
task showLog1 <<{
def grgit = org.ajoberstar.grgit.Grgit.open(dir: '')
def log = grgit.log {
range '$tag1','$tag2'
}
}
Now I was using my tag names after the range but I want to pass this through Command Line. I have gone through few links like http://mrhaki.blogspot.in/2010/10/gradle-goodness-pass-command-line.html and I am passing from cli using -p like below:
gradlew showLog1 -ptag1=tag_one -ptag2=tag_two
But this doesn't give me the log. Anything that I am missing
答案 0 :(得分:0)
尝试大写“P”。
像这样:-Ptag1 = tag_one -Ptag2 = tag_two
答案 1 :(得分:0)
它的工作,我需要写下面的任务: 的的build.gradle 强> def grgit = org.ajoberstar.grgit.Grgit.open(dir:&#34;&#34;) def log = grgit.log { 范围&#34; $ tag1&#34;,&#34; $ tag2&#34; }
然后我需要像这样执行它: 命令行 gradlew showLog1 -Ptag1 = tag_one -project-prop tag2 = tag_two
答案 2 :(得分:0)
如果您通过-P选项传递vars作为格式-PvarName = xxx。 varName成为buildScript
中项目对象的属性if (project.hasProperty('varName')) { //check varName is set or not
println "varName set to:" + varName; //use the varName directly.
}