Szczepan Faber wrote:
> 
> Oups, a correction to (2):
> 
> task stopTomcat(type:Exec) {
>   commandLine = ['cmd', '/c', 'stop.bat']
>   workingDir = file('../tomcat/bin')
> }
> 
I appreciate the response.  I'm trying to implement your suggestion but I've
run into a snag, detailed below:

First, I've put "start.bat" and "stop.bat" files under CATALINA_HOME/bin,
each of which I've manually verified will start or stop tomcat.

Next, I set env=System.getenv() at the top of my build.gradle file since
CATALINA_HOME is an environment variable

Then I've created a stopTomcat task under subprojects{} because I don't want
to have to put this in every project where I need it:


        task stopTomcat(type:Exec) {
                commandLine = ['cmd', '/c', 'stop.bat']
                workingDir = file(env['CATALINA_HOME'] + '/bin')
                println workingDir
        }
(I added the println to verify the workingDir is getting populated with the
correct path)

When I attempt to run that task, I get the following output:


Yes, Master?
C:\git\code>gradle :app:DPU2:stopTomcat -a
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
:app:DPU2:stopTomcat
'stop.bat' is not recognized as an internal or external command,
operable program or batch file.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:DPU2:stopTomcat'.
Cause: Command 'cmd' finished with (non-zero) exit value 1.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.

BUILD FAILED

Total time: 7.86 secs


What did I miss?

--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Execute-command-line-task-tp4311284p4311661.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to