Problem with gradle daemon and sshexec


(Marcelo Emanoel Bezerra Diniz) #1

Hi I’m having trouble using gradle daemon and sshexec.

If I disable the daemon everything works fine. But as soon as I start with the daemon the ssh commands just end with a -1 status.

here’s how I’m doing it:

configurations{
  sshAntTask
}
repositories{
  mavenCentral()
}
  dependencies {
  sshAntTask 'org.apache.ant:ant-jsch:1.7.0'
}
  task send {
  description = 'Update files on remote server.'
  doLast {
      if(!ant.project.targets.containsKey("sshexec")) {
          ant.taskdef(name: 'sshexec',
                      classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec',
                      classpath: configurations.sshAntTask.asPath)
      }
      if(!ant.project.targets.containsKey("scp")) {
          ant.taskdef(name: 'scp',
                      classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
                      classpath: configurations.sshAntTask.asPath)
      }
  }
}
  send << {
      logging.level = "INFO"
    loadConfiguration()
      sshExec(config.stopCmd)
    sshExec(config.cleanWork)
      ant.scp(todir: "${config.username}@${config.host}:${config.deployDir}",
            port: config.sshPort,
            password: config.password,
            verbose: true,
            trust: true,
            file: war.archivePath)
      sshExec(config.startCmd)
  }

And this is the output generated with the daemon running

gradle -Denvironment=dev check war send
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:war UP-TO-DATE
:send
Trying to override old definition of datatype sshexec
Trying to override old definition of datatype scp
Environment is set to dev
[ant:sshexec] Remote command failed with exit status -1
  BUILD SUCCESSFUL
  Total time: 23.822 secs

(Szczepan Faber) #2

What’s the output if you run sshexec with verbose? You can also try running Gradle with --debug (please use gist to share that log :).


(Marcelo Emanoel Bezerra Diniz) #3

Hi there it seems that it was a problem with the ssh command… the message was present in the log when running the build without the daemon… but was buried inside other things… thank you for your help.