Using maven to build plugins for IDEA?

Hi,
I try to use maven to build plugins for IDEA. I found some examples in the web of how to build a plugin with maven and it even works.

But I found one problem that I'm not able to resolve - when I create normal (non maven) plugin project I can run it and debug in IDEA without any hassle. Of course I can't do this with the maven based plugin project - when I want to run it I can't select any modules for "Choose classpath and jdk from module:" and can't run it.

I hasn't been able to find any clues as to what to do next. I thought I ask you gurus :) Is there any hack I could try?

In last case I'll just maintain separate configurations.

Kind regards,
Pawel

11 comments

Do you mean you want "Choose classpath and jdk from module:" option for maven tasks? Is it is so what semantics would it have?

0

THing is, IDEA maven importer doesn't have a clue that the pom you're opening is an IDEA plugin so it does import it as a Java Project which doesn't allow running/debugging the plugin.

Unfortunately i didn't find a way around that, but creating an IDEA module from scratch , not linked to the maven's pom.

Possibly if the plugin "nature" was handled with a facet, it would be possible ?

0

Thanks for replay. I ended the same way as you did.

That'd be great if there were something like plugin facet.

0

That maven plugin do you use to produce idea plugins?

0

I was talking about the Jetbrains Maven integration plugin, that creates a ipr/iml from one or more poms.

0

No-no 8) I mean do you use some maven plugin or something to configure your pom.xml? Anything that could help us to distinguish it from regular poject.

0

unfortunately no, you can have a look at my plugin's pom here

http://ideamksplugin.googlecode.com/svn/trunk/pom.xml

I guess the only specific thing is that plugins will need to declare a dependency on IDEA's openapi jar, but as those are not maintained by jetbrains (i would love them to be !) everyone may use different groupid/artifactid for them

0

Why not make an extension to Maven so one could specify that a project has a packaging type of idea-plugin or something. The pom for such a project would look like this:

... idea-plugin ... ]]>

For documentation on making such an extension, look at the Maven site (maven.apache.org)


Regards,
Stig

0

Sensible idea. You can create jira issue for this one.

0

But I found one problem that I'm not able to resolve
- when I create normal (non maven) plugin project I
can run it and debug in IDEA without any hassle. Of
course I can't do this with the maven based plugin
project - when I want to run it I can't select any
modules for "Choose classpath and jdk from module:"
and can't run it.


You will need to edit a module's .iml file manually. In the beginning of the .iml file there is type="JAVA_MODULE" and you will need to change it to type="PLUGIN_MODULE". After restarting the project IDEA will identify it as a plugin module.

I managed to use Maven successfully for building my plugin. You can have a look at the sources at http://plugins.intellij.net/plugin/?id=1605 - maybe the project structure and assembly descriptors will be useful to you.

0

Thanks. I already found this. But in case you have a project depending on maven totally and IDEA is using dynamic linking between pom.xml and .ipr there's no .iml file at all (I think it's build in memory).

For now I'm synchronize manually, I'm using maven-idea-plugin.

0

Please sign in to leave a comment.