Bug in gmaven-plugin execute goal (using by groovy)

226 views Asked by At

I try to set system property using by gmaven-plugin in build time.

but property result is diffrent in linux and window build environment.

In linux environment, it have double quote string. but window is not.

why is result different? Could you answer me please?

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>
1

There are 1 answers

0
magnus On

groovy script have a problem.

so need to split parameter like this.

def a = ['git', 'log', "-n1" , "--pretty=format:%H", 'web/'].execute().text.trim()