Maven dependency management with for plugin development

Hi all,

I'm a huge fan of Maven, and I would really love for it to be handling my dependencies for me when doing IntelliJ plugin development.
I have searched the forum and come across older posts suggesting that this may be possible to do in the future...

So the question is, can we use maven now? :)

Alan

14 comments

You can (and you always could), but there is still no official repository where the IntelliJ IDEA jars are available, and no one is working on it at the moment.

0

Thank you for your response Dmitry.
My concern was that I couldn't provide a plugin runtime configuration; But after you confirmed it was possible I kept trying to make it work.

For anyone Googling, I managed to get this working my manually editing my IML file and providing the attribute isMavenModule, and setting the attribute type to be PLUGIN_MODULE

For example

<?xml version="1.0" encoding="UTF-8"?>

<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="PLUGIN_MODULE" version="4">

There may be a better way to do this though!

Alan

0

Hi,

If anyone is interested, here's how we integrate Maven and IntelliJ plugin development at my company :

http://labs.bsb.com/2013/11/how-to-manage-development-life-cycle-of-intellij-plugins-with-maven-2/

Regards,

Gauthier

0

Hi Gauthier,

This is really interesting - thanks! I've been trying to work out what the best solution is for using Leiningen (a Clojure tool, uses Maven under the hood), some great ideas there.

Cheers,
Colin

0

Hi Gauthier,

This seems really good, thanks for posting the article!

For what it's worth; I was also able to convert my plugin to use Maven also here - and coincidentally I ran into exactly the same problems as yourself! So it's defintely interesting seeing different approaches for getting IntelliJ to work with Maven! :)

Alan

0

Interesting approach Alan, I like it. I was planning to try something similar myself. Ideally it'd be nice to detect the jars which are actually available publicly so they're not duplicated, but the effort involved in that is fairly great and the benefit probably fairly small. I'm not aware of any good way to parse the version number from a Jar file name, unfortunately, which would be a prerequisite of doing that.

0

Hi Alan,

Thanks, for your interesting answer. Having looked at your pom.xml files, it seems that you have direct dependencies on IntelliJ's jars, do you upload them manually in your repository ?

That's one of the things we wanted to avoid, since we don't have full information on these artifacts*, we don't want to waste time to upload them one by one and adapt all pom.xml** file any time a new IntelliJ version is released.

With our solution, maintenance is easy when a new IntelliJ is released : download, install, zip, upload and change version in pom.xml. Less than half an hour of work to upgrade IntelliJ dependency version in our plugins.

Best regards,

Gauthier

*  By full information I mean precise version and precise dependency graph (even in META-INF/MANIFEST.MF we can't always find a version)
** In the case of new jars or deleted ones, the depedency list must be adapted in pom.xml

0

I just use maven to download dependencies to a specified folder and use it as normal Plugin project.

https://github.com/krasa/EclipseCodeFormatter/blob/master/DependencyDownloader/pom.xml

0

Hi Meo,

I'm not sure we're trying to do the same thing. My goal is to be able to launch goals like "mvn clean deploy" or "mvn release:prepare release:perform" on an IntelliJ plugin project.

Regards,

Gauthier

0

I use this to automatically upload everything to my local maven repository - or pointing it to install on artifactory/nexus would be great too
I actually forgot that I have posted all the steps I used to develop with maven here - developerSetupGuide.md 

With this solution I didn't have to deal with any version issues either, since the bash file just installs everything under as intellij's groupId, with the build number as the version number

Perhaps the different methods of using Maven could be added to the Jetbrains documentation to help others in the future too? :)

0

To manage dependencies of your plugin with maven you can use the Maven Dependency Sync plugin.

0

In my understanding, Maven Dependency Sync plugin is useful to manage module dependencies in IntelliJ using information from pom.xml, without using Maven as a build tool.

This is the exact opposite of what Alan, Colin and I are trying to achieve.

During development phase I can use IntelliJ's standard way for plugin development, no problem with that, I don't need to outsource dependencies in a pom.xml.

But when it comes to release or deploy, I don't want to do it manually, this is error prone. I want Maven to do it for me, outside IntelliJ, and that's where I need a pom.xml and correct dependencies.

Regards,

Gauthier

0

Right, the fundamental difference is that we'd like to be able to add a dependency on a version of IntelliJ in our poms. I'd like to be able to add:

<dependency>
    <groupId>org.jetbrains</groupId>
    <artifactId>intellij</artifactId>
    <version>12.1.6</version>

 
    <scope>provided</scope>

</dependency>

...and use that to compile my plugin. It should be possible to go through the jars from an IntelliJ install, create a pom packaged project with all the dependencies - many of them are public, and those that are not would be installed locally. Unfortunately this is difficult do to since the jars don't have consistent version information. Some have version info in the names, some have it in the manifests, and some have neither. I actually investigated this a bit the other day and had some success searching at https://repository.sonatype.org/index.html#nexus-search;quick~ using the checksum search (which uses the SHA1 of the jar) but it's still not complete. Alan's script basically gets all the jars and installs them wholesale, which works and is low maintenance but installs redundant copies of lots of them in the local repo, which may or may not be a problem.

It's only tangentially related to this, but I posted some details this morning on how I run tests for my plugin here: http://devnet.jetbrains.com/message/5504834#5504834. Might be of interest.

0

Right, Maven dependency sync plugin helps to manage transitive dependencies with maven instead of configure it manually.
If some one needs only this, the plugin might be helpful.
Using it you still build the plugin with default way using the intellij and not maven to create the zip file.

0

Please sign in to leave a comment.