How to configure IDEA to perform a postcompilation task?

While trying to run some code after the compilation is complete, I wrote the following in my sbt assembly:

compile in Compile <<= (compile in Compile) map { x=> // post-compile work doFoo() x } 

Which works well if I run sbt compile from the command line, but fail to execute when I build from IntelliJ IDEA.

Is there any way to get IntelliJ IDEA to execute my post?

+7
intellij-idea sbt
source share
2 answers

It seems that the only way to support IntelliJ IDEA is Ant, unfortunately.

See the command line equivalent of post post build event in IntelliJ IDEA? .

Also, if you go down this route, you might be interested in using ant4sbt .

0
source share

IDEA has start / debug configurations.

In the Before Launch option, we usually have Make as the default action.

This is just adding the Run external Tool action after Make. We can define any number of actions.

An external tool can cause SBT .

Or we can remove Make and invoke SBT to handle the whole process. The only inconvenience of this is that it is a little easier to deal with syntax errors during compilation.

0
source share

All Articles