Share a project with Maven plugin

I've set my plugin up to create a project, and everything works fine, but the project is based on Maven. There's additional things I want to do with the plugin besides just generating the project, but Maven always pops up and says it detects a Maven project. This is fine, I was hoping to let Maven work like normal and my plugin to handle the rest, but Maven always says it must take over the project away from my plugin. What can I do? I wanted to run both side-by-side, but that doesn't seem possible. I considered taking the Maven plugin and building on top of it, so it could be a project of my plugin and still have the Maven functionality, but that's overly bulky and not optimal. That also doesn't help the issue with the normal Maven plugin asking to take over the project, unless I could maybe trick it to stay away.

Any suggestions?

6 comments
Comment actions Permalink

Does what I'm saying make sense? I can try to re-explain it if it isn't. I don't necessarily want or need my plugin to "share" the project with the Maven plugin if there's another option. I just want to be able to to make a specific project type with special support for the API this project works with while implementing Maven. Kind of like how you can create an Android project that also uses Gradle, except not near as extreme.

0
Comment actions Permalink

Hi Kyle,

Could you clarify what do you mean "Maven always says it must take over the project away from my plugin"?
It's not clear for me why importing this kind of maven projects using IDEA maven integration is not an option for you.
Have you tried to use "org.jetbrains.idea.maven.importer" (extending org.jetbrains.idea.maven.importing.MavenImporter) extension point for your needs?

Btw, Android plugin built on top of IDEA Gradle integration plugin, it uses extensions provided by the integration to contribute android specific features.

0
Comment actions Permalink

This is definitely what I'm looking for. However, I've been looking through the source for the Maven plugin and the Google App Engine plugin (since it uses the "org.jetbrains.idea.maven.importer" extension point) but I'm really struggling to figure anything out. Do you know of any resources and documentation that explains how to actually use this? It's like I'm completely shooting in the dark trying to figure this out. I've extended that class and added the importer class to the <extensions> block of the config file for the <depends> block for "org.jetbrains.idea.maven" in my plugin.xml. However, this doesn't do anything: when I create a new project or import an existing project, my MavenImporter is never called. What am I missing?

0
Comment actions Permalink

Unfortunately I'm not aware of other documentation of the MavenImporter than the API itself.
How do you define the maven importer? Could you send the content of your "depends" and "extensions" blocks?

0
Comment actions Permalink

Sure.
Depends block in plugin.xml:

 
<depends optional="false" config-file="bukkit-plugin-maven-support.xml">org.jetbrains.idea.maven</depends>


and my bukkit-plugin-maven-support.xml:

 
<extensions defaultExtensionNs="org.jetbrains.idea.maven">
    <importer implementation="com.demonwav.bukkitplugin.maven.bukkit.BukkitImporter"/>
</extensions>


BukkitImporter extends MavenImporter, but I haven't done much with it yet. I've put a breakpoint and a System.out.println() in the constructor, but the println() is never called, and the breakpoint is never hit. I've tried to create, open, or import all kinds of different maven plugins, but I can't seem to get it to work.

0
Comment actions Permalink

Okay, so I moved the <extensions> block to my plugin.xml and now it works perfectly! That answers my question for now - and it's a much nicer and cleaner answer than I expected.

0

Please sign in to leave a comment.