Executing Maven Target From Within Intellij Plugin
已回答
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
请先登录再写评论。
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.
Excellent!
Thanks, Dmitry!
-- Cam
This link is broken, Can you describe in detail how to solve it? thank you
https://upsource.jetbrains.com/intellij/file/HEAD/community/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/MavenExecuteGoalAction.java
Dear Jakub, I open this link shows “403 Forbidden”.
That's odd. Here you have a GitHub link instead: https://github.com/JetBrains/intellij-community/blob/master/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/MavenExecuteGoalAction.java
Nice, this link is ok.
Is there any detailed tutorial on this?
I can't find this jar, where can I find it.thanks
org.jetbrains.idea.maven