IntelliJ IDEA: run batch script package before and after start / debug configuration

Background:

I have a startup script that starts a maven build. I already have a path to the context that is meant to view the Target directory in the Build directory, so I don’t need to manually copy the war file every time I run the build.

I would like my build configurator to automatically kill the running tomcat process, start the build, and (if successful) restart tomcat.

Problem:

I would just like to call the tomcat start / stop batch files before and after the build, but I hit two misses:

  • In the section "Build Configuration"> "Before Running" there is no way to execute a batch script package
  • It seems that there is no post-build section to complete phase 2

Is there a way to enable these options for my current build configuration (via a plugin or similar)?

-OR -

Is it possible for assembly configurations to be executed sequentially (one after the other) and is there a plugin or something to create a batch assembly configuration script?

+6
source share
1 answer

It is not possible to run a batch script package directly in IDEA, or perform a sequence of actions before running in IDEA 11.

In IDEA 12, you can specify several actions to perform before starting, so you can create a Maven target that will restart Tomcat (by running the batch version of the script or some other way) and in the Before Launch list, specify 2 actions: kill the running Tomcat process (which may be another Maven target, a different launch configuration or Ant task) and run the build (Maven target). Here's what this interface looks like in IDEA 12:

Before launch

When you run this configuration, it will kill Tomcat, build and reboot Tomcat.

It should also work if you associate multiple launch configurations with the Run Another Configuration Before Launch step.

IDEA 12 is scheduled for late 2012, but the first versions of EAP will be available in a few weeks.


Another solution would be to use the same Maven goal with the Mojo Executor or Ant task, which will complete all 3 actions.

+11
source

Source: https://habr.com/ru/post/918146/


All Articles