Downloading the internet with Maven in a new light

I have my share of complaints like everybody else about Apache Maven and one of them is that upon installation (or upgrading to a new plugin version) it starts downloading half of the available internet. Maven is constructed in a highly modular fashion, requiring lots of different, small, focused Java libraries. I’d like the distribution to contain those libraries, but I digress. Tonight I saw that not only Maven is structured this way. It is something *all* open source projects got.

For example, the much touted Ruby on Rails project with their disdain for everything Java would probably cringe at Maven (it uses XML after all). But installing Ruby on Rails and for example Radiant CMS with some plugins is a futile attempt in finding the right invocations of: script/*, rake, gem, port and other commandline tools you’ll want to get familiar with. All these tools start downloading stuff from the internet from different repositories (SVN, ruby forge, etc).

Maven: you’re not alone anymore in downloading the internet for your builds…

Tags: , ,

11 Responses to “Downloading the internet with Maven in a new light”

  1. Jim Gay says:

    The promise of modularity brings complexity.

    But it sounds like you’re not using a bare bones setup. Is it Rails and Radiant that are adding the complexity, or your project?

    I recall getting Rails setup on earlier versions of OS X being difficult, but it’s part of the standard install today.

  2. Stefan F says:

    Well, Maven … yeah, I have quite a few things to complain about. But the downloads? Just put it to offline mode (mvn -o clean install) or get yourself a repository manager. To me, it’s mostly the dependency managment that is a constant pain.

    [Attention, Your about to read a brain dump on improving Maven dependency management ;) ]
    I’d love to see Maven dependeny management getting more like Debian (Ubuntu) package management. With things like “jcl-over-slf4j replaces commons-logging”, “org.mortbay.jetty.servlet-api provides javax.servlet-api”, “hibernate conflicts with jdo”, “wicket suggests wicket-extensions”, … and another cool thing to have would be to get modules, that can be enabled, where a module is basically a feature set which has dependencies (e.g. the servlet module of commons-logging would require the servlet-api – currently it does this if you don’t exclude it – but commons-logging still is a single jar) Or think about spring with it’s “get all in spring.jar” or “choose what you like with spring-jdo, spring-web, spring-…” – too bad that dependencies don’t agree in which approach they prefer (and you’ll end up debugging weird errors due to different versions of the same classes on the classpath). Packages could easily be inspected, added, and removed with convenient command line tools (e.g. `mvn-get install wicket` and it would immediately list available modules to activate and suggest more packages to install (e.g. wicket-extensions for wicket). No manual XML wrangling or half-baked IDE plugins anymore. Does that sound to cool to be true? Or is there already something like this? If yes, I’d probably die for it :)

    Finally, I’d like to say sorry for answering questions you’ve never asked. It just struck me and I had to write it down – somewhere.

    Cheers, Stefan

  3. Quintesse says:

    @Stefan: you do realize that Maven is a build tool and not a package management system? Most of your suggestions are just not useful in a build system. “Hibernate conflicts with JDO”? Then why are you adding them both to the same module? But they could be part of the same project so both of them might need to be installed. “mvn.-get install wicket”? You really want others to go through that before they can build your project? There is a reason it’s written down in an XML file, so you can just give that to someone and not worry about having to explain where to download and how to install and configure all the dependencies. Yes, maven can definitely be improved a lot, but IMHO I don’t think this is the way to go.

  4. Quintesse says:

    @Martijn: I do agree that Maven at times downloads way too much stuff, of course the thing is that it’s almost impossible for Maven to know what you are going to use and what can be safely ignored.

    You might do some static code analysis to determine dependencies but Maven would miss out on the runtime dependencies and once your app is running Maven isn’t around anymore to download the missing dependencies.

    Until we get proper module support in Java, that is.

  5. AFAIR I had to upgrade gem, upgrade rails, upgrade radiant, install ImageMagick, gem install rmagick, etc…

    I don’t mind having to install stuff, but figured the grass was greener on the other side, but apparently it isn’t. C’est la vie…

  6. Maven downloads ‘just enough’ IMO, i.e. just what’s needed. This doesn’t mean it is overwhelming for new co-workers that have to install maven for the first time and start working on our project. Even with a repository manager, the list of downloads goes on and on and on and on and on….

  7. Jim Gay says:

    So you wanted specific versions and specific pieces of software? Why wouldn’t you expect to need to install them?

  8. Not sure why you feel so threatened or attacked. I merely observed from my Java/maven experiences that the grass is definitely not greener on other pastures. It is comforting to know that. Jeez.

  9. Jim Gay says:

    I don’t know how you got the impression that I felt threatened or attacked. I don’t. (I assume that last comment was for me)

  10. Stefan F says:

    @Quintesse First of all: I know that maven isn’t a package/dependency manager but a build tool. But imho the dependency management is one of the best and worst features at the same time. You also got me wrong on the dependency management thing. I don’t want users of my project to install all the dependencies by hand (e.g. mvn-get install wicket) before they are able to use my stuff. That’s only the way to add dependencies to the POM instead of doing plain XML without knowing what is done (So you’d be able to check those changens into your repository and all others could get them from there). I’d also like to be able to search repositories and inspect packages using the same tools I use to manage those dependencies. And the hibernate vs. JDO thing is simple. I didn’t add them myself. But such things are likely to happen with transient dependencies. However, I’d also say, that this isn’t always the problem of Maven itself as there are for instance some artifacts out there, that depend on JUnit without specifying a scope (which adds Junit to your war for instance).

  11. It’s make me confused. Maven is constructed in a highly modular fashion, requiring lots of different, small, focused Java libraries. Would you post about basic learning?

Leave a Reply