我尝试在构建时使用gmaven-plugin来设置系统属性。
但在linux和window构建环境中,属性结果是不同的。
在linux环境中,它有双引号字符串。但是window不是。
为什么结果不同?你能回答我吗?
build result
linux : ### commitId : "8def4294ccb346795bd9682b5bcb9174bc64d78f"
window : ### commitId : 8def4294ccb346795bd9682b5bcb9174bc64d78f pom:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<properties>
<script>git log -n1 --pretty=format:"%H" web/</script>
</properties>
<source>
def command = project.properties.script
def process = command.execute()
process.waitFor()
project.properties.setProperty('commitId', process.in.text.trim())
println '### commitId : ' + project.properties.commitId
</source>
</configuration>
</execution>
</executions>
</plugin>发布于 2016-05-25 17:47:36
groovy脚本有问题。
所以需要像这样拆分参数。
def a= 'git','log',"-n1“,”--pretty=格式:%H“,‘web/’..execute().text.trim()
https://stackoverflow.com/questions/37426481
复制相似问题