Necessitas - Jar management for Eclipse

Eclipse, Java, Necessitas Add comments

The first public release of Necessitas is now available.

Necessitas is an Eclipse plug-in that adds a class-path container to manage a projects jars using the ivy dependency manager. In short it gives you many of the advantages of ivy without leaving eclipse.

What it does now

  • Downloads the declared dependencies to the ivy cache
  • Adds the downloaded jars to your class-path
  • Can be configured to update the jars each time the ivy.xml file is updated

Still to come

  • The ability to specify an ivy config file to use
  • The ability to specify the module configuration to use
  • Maybe, the ability to automatically download and associate source files

I’ve found a couple of issues in the way that ivy exposes information about what is in the cache, what it needs to download etc. None of these are irresolvable they will just take some time and co-operation with the ivy crew (who are very responsive)

Screen shot of the container configuration dialog

You can download it via the eclipse update manager from http://eclipse.oneill.id.au/updates/

39 Responses to “Necessitas - Jar management for Eclipse”

  1. Kim Pepper Says:

    Awesome idea! I have writen a simple ant task that generates the .classpath file based on a fileset, but this is much more appealing.

    I’ll give it a go!

    Kim

  2. Kim Pepper Says:

    I have 4 configurations: compile, runtime, test and etc. Unfortunately, Necessitas includes them all and creates duplicates in the library - most likely because I have no ‘default’ conf.

    The ’select’ button is disabled so I can’t change this option.

    Kim

  3. Kevin O'Neill Says:

    I’ll be adding support for different configurations in the next release.

  4. kermitt Says:

    Does it works with Eclipse 3.1?

  5. Kevin O'Neill Says:

    Sure does. In fact it may only work with 3.1 as that is what I develop on. I can tell you it works on Linux and the Mac. I have no idea when it comes to windows.

  6. nicolas Says:

    Great idea !

    Is there a chance to have a version of Necessitas working with Eclipse 3.0 ?

  7. Kevin O'Neill Says:

    The will work in 3.0. Where I had issues was clearning tables. So I took the easy way out ;). I’ll see if I can find another way of doing it for version 0.3.

  8. Kim Pepper Says:

    Is there anonymous cvs/svn access?

  9. Kevin O'Neill Says:

    Not yet. Need to find a decent place to host. By the way. Don’t we know each other?

  10. Kim Pepper Says:

    Does System Stanley mean anything to you?

  11. Marc Says:

    Great plugin, thanks!

    I have one issue/feature request. I am unable to add a Source attachment or Javadoc location for any of the jars in the Necessitas Container. Is there a way to enable this?

  12. Glen Says:

    Hi Kevin,
    I have similar code to this. I just spoke to Xavier and he said I should contact you. Do you want a hand with anything?

    What I have is a similar classpath container. Very alpha as you add the container to your project by manually editting the .classpath. Once editted the eclipse project finds the ivy.xml file and an optional ivy.properties files (you can configure the location of ivycfg and the conf to use for example).

    At the end of the day you have a single expandable tree in the eclipse package view that says “Ivy Classpath Container” and if you click on it you see all the jars.

    Anyhow let me know I am keen to get something done soon and am not concerned about whose code is used rather there is an eclipse ivy plugin because I MUCH prefer using ivy and ant over Maven (for example). And would like to make it easier for people to use them…

  13. Kevin O'Neill Says:

    Hey Marc,

    I’ve been looking ito ways of doing this. The issue is that I need to get the information from ivy but at present Ivy doesn’t “bundle” it together in a way that I can use. I will find a way though as it’s something tht I like to use day to day.

  14. Kevin O'Neill Says:

    Hey Glen,

    I’m happy to incorporate anything you might have (and give credit where credit is due). At the moment I’m working on 1.1 integration and support for specifying specific configurations, linking in additional related artifacts (eg source code) and better reporting.

    So sure, if yo have anything you’d like to contribute that would be great.

    Oh I’m also trying to figure out how to get the source built into the plugin so that it can be imported into eclipse for editing.

  15. David Kyle Says:

    I thought this would help Eclpise users.

    How to install:
    1) Start Eclipse
    2) Help->Software Updates->Find and Install…
    3) Select “Search for new features to install”, click Next
    4) Click “New Remote Site…”
    5) Enter name: necessitas update site and URL: http://eclipse.oneill.id.au/updates
    6) Select the “necessitas update site” and click Finish

    Necessitas will be downloaded and installed. Make sure you restart Eclipse.

  16. David Kyle Says:

    How to use:
    1) Right click on an Eclipse java project, select Build Path->Add Libraries
    2) Select “Necessitas Managed Dependencies”, click Next
    3) The necessitas “Add Library” dialog will appear

    I hope this is correct.

    I am seeing duplicate jar entries in the “Located Jars:” list that cause a ‘Build path contains duplicate entry:….’ error.

  17. Kevin O'Neill Says:

    Thanks David,

    you know I’d neot actually thought to tell people the basics :S.

    To answer you question. The released version uses “*” as the configuration to parse so all declared jars are included. This means that if a jar is in two configurations it will be detected twice. I’ve added support for configurations in the dev version and I’ll make sure to remove dupicates.

    -k.

  18. Peter Oxenham Says:

    Great tool.

    Only one problem. Part of the requirements for my project is a JNI library which includes a *.DLL file. Ecplise gives an error because a dll file is in the classpath.

    Previously the dll file gets downloaded as part of my ivy ant task but NOT included in the classpath.

    How do I get around this??

  19. Kevin O'Neill Says:

    Humm, probably don’t with version 0.3.1. I probably should check the artifact type before I assign it to the classpath. I’ll take a look and see if I can determine the artifact type and only add jars.

    -k.

    ps: If you have a config you can share that would be great.

  20. David Hergert Says:

    Kevin,
    First I’d like to say, great job with this project and allowing us to use the power of Ivy from Eclipse. As I use this app and look over the source, if I ever see places where I can contribute, I will be sure to let you know.

    Anyways, is there a place on your site, besides a comment on this thread, where you publish your eclipse update site URL?

    Thanks!

  21. Barry Kaplan Says:

    I’m a bit confused. I have an ivy.xml file that declares a zillion jars as dependencies (direct and indirect). When I go thru the add-library I am presented with only four jars. I don’t see any pattern as why these 4 where displayed and not the other 30.

    Is there any logging that I look at? Or any other way to debug what is going on?

    thanks

  22. Kevin O'Neill Says:

    David,

    I’ve been working on a specific project site as time permits, as soon as it is ready I’ll let people know.

  23. Kevin O'Neill Says:

    Barry,

    Does ivy declared in ant resolve the jars. More than likely the artifacts can’t be found necessitas links the ones that have been resolved. I’m working on a better ways of displaying this for a future version.

  24. Barry Kaplan Says:

    Yes, ivy resolves all the jars. I use and everythings is populated in the ivy cache. Then I use as the only source for classpaths in my ant build and everything.

  25. Barry Kaplan Says:

    (sorry, some of my text above got cut out. I mean to say that I use the ant tasks ivy:resolve and ivy:cachepath)

  26. Peter Oxenham Says:

    Kevin, Here is the config file for the module in question:

    And the dependency line in the projects ivy.xml file is

    WIN32″/>

    I hope this helps.

    Peter

  27. Maarten Coene Says:

    Hi,

    I have a custom RepositoryResolver class specified in my ivyconf.xml. How can I tell Necessitas where to find that class?

    I have added it to the ivy-1.1.jar which was included in au.id.oneill.necessitas.core_0.3.1.jar, but I get this error when trying to add a library:

    java.text.ParseException: failed to configure with file:/C:/working/ph_tcomp/commons/ivyconf.xml: problem in config file
    at fr.jayasoft.ivy.xml.XmlIvyConfigurationParser.parse(XmlIvyConfigurationParser.java:64)
    at fr.jayasoft.ivy.Ivy.configure(Ivy.java:237)
    at au.id.oneill.necessitas.core.classpath.NecessitasClasspathContainer.resolve(NecessitasClasspathContainer.java:170)
    at au.id.oneill.necessitas.core.classpath.NecessitasClasspathContainer.refresh(NecessitasClasspathContainer.java:150)
    at au.id.oneill.necessitas.core.classpath.NecessitasClasspathContainer.getClasspathEntries(NecessitasClasspathContainer.java:80)
    […]
    Caused by: java.lang.ClassNotFoundException: custom.CustomRepositoryResolver
    at fr.jayasoft.ivy.xml.XmlIvyConfigurationParser.startElement(XmlIvyConfigurationParser.java:135)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1674)

    any idea?

    regards,
    Maarten

  28. Kevin O'Neill Says:

    I’ll need to take a look at the ivy class loader. This is something I would like to incorporate for version 1.0. For now you could try adding the jar to the lib directory of the plugin and adding a reference from plugin xml / properties.

  29. J. Matthew Pryor Says:

    If you are interested, we have added maven1 & maven 2 support to Necessitas. We’re happy to contribute the code back if you wish to take it on.

  30. kermitt Says:

    Hi,

    How do you configure the ivy configuration file, the ivy file and their location?

  31. Kevin O'Neill Says:

    For the moment they are always located in the root of the project.

  32. Glen Says:

    As an FYI when you I put an ivyconf.xml in the project root I had to restart eclipse for it to get picked up by Necessitas…

  33. Peter Oxenham Says:

    Kevin,

    I’ve just noticed that my last post didn’t work. It there another way I can get you the config file?

    Peter

  34. Kevin O'Neill Says:

    email it to kevin at oneill.id.au

  35. Karl Nosworthy Says:

    I was wondering how progress was coming on the “still to come” items?

  36. Kim Pepper Says:

    Looking forward to the next release!

  37. kermitt Says:

    Thx for this new release!

    First of all, I don’t see anymore the source, why ?

    I am using my own resolver and it complains with a ClassNotFoundException , could you please add a way to configure the class used ?

    The ivy and ivyconf are not at the root of my project, could you please add a way to set the path to the ivy file and to the ivyconf. By the way Ivy add remote ivyconf , it could be nice to take advantage of.

    In the message box, could you add also the errors? I can see them using the PDE error view but it will be much better to have them just there.

    one more question ? Why do not share this project so people could improve it?

    Good Work!

  38. Kevin O'Neill Says:

    No Source, because I’m a nuff nuff. I really should create an ant script for building the releases. I’ll make sure it’s included in the next version.

    I haven’t looked at custom resolvers yet. It will require some classpath manipulation. I’ll take a look at it for a future version.

    Internally I make no assumptions about the location of the ivyconf or the ivy files. Ill add a way for you to specify the ones to use in an upcoming version.

    The messages box is the information provided via Ivy. The information in the error log is generated from internal exceptions. I’ll see if I can find a way to combine the two.

    I’m working on a specific project site as time permits probably to be hosted at javaforge.

  39. Jake P Says:

    Is there a way to specify a web proxy to use? I am having problems with outgoing connections for this plugin. Does it use the Eclipse settings under Install/Update, or do I have to set the the JVM System Property http.proxyHost ? Not sure where I can do that in Eclipse 3.1

Leave a Reply

Couldn't find your convert utility. Check that you have ImageMagick installed.