Executing Maven Target From Within Intellij Plugin

Answered

Hello

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.

Thanks!
-- Cam

9 comments
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.
https://upsource.jetbrains.com/ideac/file/HEAD/plugins%2Fmaven%2Fsrc%2Fmain%2Fjava%2Forg%2Fjetbrains%2Fidea%2Fmaven%2Fnavigator%2Factions%2FMavenExecuteGoalAction.java

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.

1
Comment actions Permalink

Excellent!

Thanks, Dmitry!

-- Cam

1
Comment actions Permalink

This link is broken, Can you describe in detail how to solve it? thank you

0
Comment actions Permalink

Dear Jakub, I open this link shows “403 Forbidden”.

0
Comment actions Permalink

Nice, this link is ok.

Is there any detailed tutorial on this?

0
Comment actions Permalink

I can't find this jar, where can I find it.thanks

0
Comment actions Permalink

org.jetbrains.idea.maven

0

Please sign in to leave a comment.