Maven2 plugins

So I decided to write a plugin for maven 2 to generate my prj.el files for the JDEE in Emacs. This was a horrible mistake because shortly after that decision I found out there is a *complete* lack of proper documentation for plugin writers.

I scavanged through source code for about 2 hours of various other plugins to actually find what I needed. 40 minutes later I had a working plugin.

I will try to write an more informative entry at a later stage, with code examples. For now, if you want to access the experimental plugin code please drop me a line.

Update: benzin (one of the commenters in the thread) patched up the plugin to deal with existing files, download sources and javadoc. He made his version available here: http://server.apnet.cz/~benzin/maven-emacs-plugin/. I need to check out the changes still, if they are good I will contact the maven people to have the plugin pushed to the repository.

19 Comments

  1. Posted February 19, 2007 at 7:45 pm | Permalink

    Hi. Was wondering if I could grab a copy of your Maven plugin for JDEE. I’m also a Emacs+JDEE user, and would like to use you experimental plugin (or at least be a guinea pig ;)

  2. Posted February 20, 2007 at 3:14 am | Permalink

    Hi,

    I uploaded a local version, which works ok enough for my needs here

    After you do a ‘mvn install’ in the resulting directory you can run the plugin on any maven project by running ‘mvn org.credmp:maven-emacs-plugin:1.0-SNAPSHOT:jdee’

    Let me know how it works for you…

  3. Skybert
    Posted March 21, 2007 at 11:48 am | Permalink

    Cool! Can’t wait to try it.

    I noticed there was an abandoned? jdee plugin for Maven1, was it possible to use any of that code in your plugin for Maven2?

    Anyways, it wold be fan-tastic to get jdee:jdee into the official Maven plugin repository. Together with changing the compilation error alist, it makes working with Maven projects in Emacs significantly easier :-)

  4. Posted March 24, 2007 at 5:45 am | Permalink

    Skybert,

    Yes, I saw the maven1 plugin as well. The radical differences between mvn1 and 2 make it impossible to just port the plugin, so I used it as a basis for rewriting it entirely.

    The current version has some issues with multi-module poms, when that is taken care of we could of course see about getting it to the repository.

    Care to help out? ;)

    Arjen

  5. Posted April 16, 2007 at 6:47 pm | Permalink

    I can’t get your plugin to execute.

    if I run (with a properly configured pom.xml):
    mvn jdee:jde

    after downloading I get this message:
    java.lang.NullPointerException
    at org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:292)
    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:198)
    at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:163)

    I think this means you have an error in your pom.xml for the plugin.

  6. Posted May 1, 2007 at 12:33 pm | Permalink

    Hi rodolfo,

    Sorry it took so long for me to respond. How about your try emacs:jdee as target?

    Could you also post your configuration for reference and reproducability?

    Thanks

  7. Jeff
    Posted December 7, 2007 at 2:54 pm | Permalink

    OK, I downloaded your two plugins, do I just compile them, make a jar, and included them in the classpath?

  8. Posted December 8, 2007 at 4:27 am | Permalink

    jeff,

    You do a ‘mvn install’ in the directory and that will put them where maven can find them… after that you just use the plugin as described above… (see earlier comments)

  9. Mike
    Posted December 18, 2007 at 3:40 am | Permalink

    Good plugin!

    Exactly what we need to get Emacs to work with Maven like the Eclipse-plugin does. Perfect for times when I don’t have the memory for a full-blown Eclipse installation (like now). Great work!

    Ever thought of letting the people at Apache or Codehaus know about it and get hosted there? I think it belongs right along side with the Eclipse and IDEA plugins. That way others can get involved and contribute (like me :-).

    I can see for example, that a “clean” goal that removes generated prj.el files would be useful to have…

    Thanks!

  10. Posted December 23, 2007 at 3:30 pm | Permalink

    I make one changes when you have some prj.el in your basic directory then will be add load-library to end of generated prj.el which read this prj.el


    # diff JdeeMojo-1.0.java JdeeMojo1.1.java
    262c262
    w.write("\"" + outputDir + "\"\n");
    267a268,276
    > File basicPrjEl = new File(executedProject.getBasedir()
    > .getAbsolutePath(), "prj.el");
    > if (basicPrjEl.exists()) {
    > w.write("\n\n");
    > w.write("(load-library \"");
    > w.write(basicPrjEl.getAbsolutePath());
    > w.write("\")");
    > w.write("\n");
    > }
    350c359

  11. Posted December 23, 2007 at 4:24 pm | Permalink

    Guys,

    Thanks for your feedback & patch. I will incorporate them (the clean target and the patch) and see about getting it in a proper maven repos.

  12. Posted December 26, 2007 at 5:37 am | Permalink

    4Core: Now I have patch for set checkstyle and I try bring functionality from maven-eclipse-plugin: downloadSource and dawnloadJavadoc.

    And then I want set sourcepath and help path to downloaded jars.

    I learn use maven api, because of is take some time to me.

    When I have done it, I annonce and give source to internet.

    I’m sory my English is too bad :(

  13. Posted December 26, 2007 at 5:31 pm | Permalink

    Hi i make some changes in plugin. Now can download javadoc and source and make witch checkstyle and some others.

    I generate page for this plugin you can see on this:
    http://server.apnet.cz/~benzin/maven-emacs-plugin/

    My Eglish is terible because of I can’t connect maven developers and give this plugin to oficial tree.

    Is anybody here who can contact maven developers?

  14. Posted December 27, 2007 at 4:30 am | Permalink

    benzin, thanks for the changes! I need to take a look at them before I can go through all the stuff to upload the plugin.

    However, the change in package name I think is not very well timed. The org.apache.maven.plugin seems reserved for official plugins, this is not an official plugin (yet)…

  15. Posted December 27, 2007 at 4:36 pm | Permalink

    I make new changes. Now can generate javadoc from dependecie sources if javadoc missing in repositorie.

  16. Posted September 24, 2008 at 4:51 am | Permalink

    Hi,

    Thanks for developing this plugin.
    I downloaded the 1.2.2 tgz, and tried to install it with “mvn install”, but it complains about the “Messages” class, used to build the final error messages for missing artifacts, etc.
    Could you please fix it or tell me where to import such class from?

    Thx!

  17. Posted September 24, 2008 at 5:55 am | Permalink

    Hi chous,

    Try the following version:

    http://github.com/credmp/maven-emacs-plugin/tree/master

    you can either use git to retrieve it, or use the download button to get a downloadable copy :)

    Regards

  18. Posted September 30, 2008 at 5:51 am | Permalink

    Thanks a lot!

  19. Posted October 11, 2008 at 3:30 pm | Permalink

    (shameless plug time)

    If you’re using JDEE with Maven 2, you may want to check out jde-mvn (http://www.bitbucket.org/espenhw/jde-mvn/); it is to maven-emacs-plugin as m2eclipse is to maven-eclipse-plugin (well; that’s where I’m aiming, anyway).

Post a Comment

Your email is never shared. Required fields are marked *

*
*