I would like to start and stop Tomcat with Gradle tasks, but I figured I would 
start slowly and see if I could get things started first. Here is my task 
(executed on my Windows box):

tomcatHome = System.getenv()["CATALINA_HOME"]

task startTomcat() {
  ant.java(jar: tomcatHome + "\\bin\\bootstrap.jar'", fork: "true") {
    arg value: "start"
    classpath {
      pathelement path: tomcatHome + "\\lib"
    }
  }
}

The result is this:

19:51:38.234 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] 
Execute:Java13CommandLauncher: Executing 'C:\Sun\SDK\jdk\jre\bin\java.exe' with 
arguments:
'-classpath'
'C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib'
'-jar'
'C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\bootstrap.jar''
'start'

The ' characters around the executable and arguments are
not part of the command.
19:51:38.343 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] 
[ant:java] Unable to access jarfile C:\Program Files\Apache Software 
Foundation\Tomcat 6.0\bin\bootstrap.jar'

Assume that file is there. Is there anything obviously wrong I am doing?

Incidentally, I tried adding escaped quotation marks to account for the spaces 
in the path, but that really made things weird.

Any insight would be appreciated.

Thanks.

Reply via email to