Executing Maven Target From Within Intellij Plugin


Could someone be able to detail how I could go about executing a maven target from within an IntelliJ plugin? or point me to an online resource/tutorial which outlines how. I'm having difficulties finding something useful through Google (everything I find relates to using maven to build an IntelliJ plugin.)

What I want to be able to do is run something like: mvn -e integration-test ....  and have the results display in the IntelliJ console (as if I ran the maven goal myself through the Maven tool window.)

Alternatively, if someone knows of an open-source plugin that does this, I can look through the source code to figure out how to do it.

Edit: I am developing my plugin using IntelliJ IDEA 14 Ultimate Ed.

-- Cam

Comment actions Permalink

The code for executing the targets is found in the MavenExecuteGoalAction class. You can copy the code and modify it as required for your particular case.

Note that, in order to use the Maven plugin classes in your plugin, you'll need to add <depends>org.jetbrains.idea.maven</depends> to your plugin.xml and add the jars of the Maven plugin to the classpath of your IntelliJ IDEA SDK.

Comment actions Permalink


Thanks, Dmitry!

-- Cam


Please sign in to leave a comment.