tomcatgradlecargo

Check if application is deployed in Tomcat using gradle


I am using gradle-cargo plugin to deploy my war to tomcat server.

I call cargoDeployRemote task for this. However it throws me an error when the application is already deployed on the server.

Deploying [C:\jenkins\workspace\myapp\build\libs\myapp.war]
:cargoDeployRemote FAILED
:cargoDeployRemote (Thread[main,5,main]) completed. Took 1.081 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cargoDeployRemote'.
...
...
BUILD FAILED

How to over come this? Is there a way where I can query the context url and find if it is already deployed?


Solution

  • After referring to the docs I'd investigate how exactly the following tasks work:

    And use appropriate combination of these tasks: e.g. maybe using cargoRedeployRemote will solve the problem? Or maybe call cargoUndeployRemote and cargoDeployRemote afterwards?