Background:
I have a Run config that runs a maven build. I already have a Context Path set up to look at the Target Directory of the Build directory, so I don't have to manually copy the war file over every time I run a build.
What I would like is for my build config to automatically kill the running tomcat process, run the build, and (if successfull) restart tomcat.
Problem:
I'd like to simply call the start/stop tomcat batch files before and after the build, but I've hit two snags:
Is there some way of enabling these options for my current build configuration (via a plugin or similar)?
-OR-
Is it possible to have build configurations run in sequence (one after the other) and is there a plugin or something to create a batch script build configuration?
There is no way to run batch script directly in IDEA and it's also not possible to make a sequence of actions before run in IDEA 11.
In IDEA 12 it will be possible to specify multiple actions to perform before run, this way you can create a Maven goal that will restart Tomcat (by running batch script or some other way) and in Before Launch
list specify 2 actions: kill running Tomcat process (which can be another Maven goal, another Run configuration or Ant task) and run the build (Maven goal). Here is how this UI looks like in IDEA 12:
When you run this configuration, it will kill Tomcat, perform the build and restart Tomcat.
It should also work if you chain multiple Run configurations with the Run Another Configuration
Before Launch step.
IDEA 12 is planned for the end of 2012, but first EAP versions will be available in several weeks.
Another solution would be to use a single Maven goal with Mojo Executor or Ant task that will perform all the 3 actions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With