Maven 2's Transitive Dependencies
I spent a few hours this week integrating Maven 2's Ant tasks into Equinox. Here's a things I discovered in the process.
- The JAR you need to include to use the Maven Tasks is quite large, weighing in at a hefty 833K. Regardless, it's easier to include a ~1MB JAR in CVS than it is 10MB of JARs. Equinox (w/o the extras directory) weighs in at 10.2MB before, 1.3MB after.
- The transitive dependencies feature needs to be cleaned up a fair bit. There are a *lot* of unnecessary dependencies downloaded for many libraries. For example, Hibernate downloads a bunch of JBoss JARs and the Display Tag downloads all the various web framework JARs. I found myself excluding almost as many dependencies as I added.
- Using in-line dependencies (where you specify each one in your build.xml) is cleaner and requires less XML (b/c of attributes vs. elements). I went this route at first and it worked well, but to allow greater flexibility (for those who might want to use Maven 2), I ended up creating a pom.xml. 48 lines in build.xml turned into 195 lines in pom.xml.
- The Maven Developer team provides fantastic support - both on the mailing list and IRC. Thanks Brett!
- Maven 2.0 RC was released today.
- I need to figure out a way to "install" the persistence/web framework options in Equinox. The easiest way from a maintenance perspective is to parse pom.xml to add new dependencies. Entity includes might make the project more extensible though - and easier to upgrade.
- Once you have pom.xml in place, it's pretty easy to make the build/test/package process M2 friendly.
- Maven 2 is faster than Ant.
Overall, it was a pretty frustrating experience, with lots of trail-and-error. In the end, I got it all figured out and the only "hack" I had to do was delete servlet-api-2.4.jar after copying dependencies into my WAR. This is b/c Ant is not smart enough to know that dependencies with a "provided" scope shouldn't be copied. I could probably have a 4th dependencies path to solve this, but deleting sounded easier at the time.
I'm not going to check anything in yet b/c I still have to modify all the installers to specify their dependencies. The main advantage I can see in using a download-dependencies feature is easier upgrading of dependencies. It'll also make a lot more sense in AppFuse b/c certain parts of project (i.e. appfuse-dao.jar) can be published as re-usable modules.
In the meantime, if you'd like to try out Equinox with this feature (works with both Maven 2 or Ant), you can integrate it into a CVS version with the following steps:
- In the equinox directory, create a lib directory and download maven-artifact-ant-2.0-dep.jar into it.
- Replace your build.xml with this build.xml (view diff against current).
- Download pom.xml and put it in the equinox directory.
- Delete web/WEB-INF/lib.
That's it! I'm sure some things can be improved - please let me know if you find any issues.
Posted by Brett Porter on October 15, 2005 at 07:42 PM MDT #
Posted by Matt Raible on October 15, 2005 at 07:47 PM MDT #
Posted by Carlos Sanchez on October 16, 2005 at 12:23 AM MDT #
Posted by Jason Carreira on October 17, 2005 at 01:49 AM MDT #
Posted by Matt Raible on October 17, 2005 at 09:23 PM MDT #
Posted by Geoffrey Wiseman on November 02, 2005 at 04:34 AM MST #
Posted by Carlos Sanchez on November 02, 2005 at 04:41 AM MST #