getting well formed output from ant - sshexec in groovy script

后端 未结 3 1852
忘掉有多难
忘掉有多难 2021-01-06 13:05

my problem is, that the output from the ant task alwas has some [ssh-exec] infotext at the beginning. can i suppress / disable that?

my code so far:

         


        
3条回答
  •  广开言路
    2021-01-06 13:16

    I tripped over the same issue in gradle and from there I had to change the way to access the property: According to the official gradle doc 3.3

    println ant.antProp
    println ant.properties.antProp
    println ant.properties['antProp']
    

    is the correct way to go.

    def ant = new AntBuilder()
    ant.sshexec(host: host,
                port: port,
                trust: true,
                username: username,
                password: password,
                command: 'ls',
                outputproperty: 'result')
    
    def result = ant.properties.'result'
    

    Hope this helps people in the same situation. Cheers

提交回复
热议问题