Wednesday, November 9, 2011

Maven vs Eclipse

Still Hard to Use

Both are still not compatible because of workflows. Maven wants you to use their tool for project creation, library downloads, compile, install. Eclipse is completely self contained allowing point and click build/execute cycles with easy to find library settings and it works by itself. You can download jars and you are clear what the workflow is supposed to be. Using maven with eclipse disrupts flow because eclipse state is stored in .project/.classpath/.settings while maven stores state in pom.xml. It isn't clear what the work flow is, are you supposed to build in maven or in Eclipse?

When you "mavenize" a project it may make for easier distribution of jars but other goals like installation and distribution are traditionally handled by rpm or deb files. POM files allow centralization of libraries into a central repo but those repos are frequently out of date and scattered across different websites. And in their zeal to start a company Maven/Sonatype tries to do other things which screws up more of the existing workflow which wasn't broken before maven came along.

So now that everybody wants to distribute a pom file with their s/w is it possible to minimize the usage of maven to only library dependencies? The problem is in eclipse you have multiple maven plugins and you have the maven command line. It isn't clear if you are supposed to create the project in maven using the eclipse plugin, create it using the command line then do an import and add facets or what... the maven website isn't clear with this option, they want you do to do everything in maven. And this leads to a significant useless time sink.

To create a simple dynamic webproject under Eclipse is simple and clear. The location of the web.xml files is clear. When you do mvn generate:archetype, it creates a separate directory for your project which is no longer aligned with the Eclipse definition of workspaces. You can import this into eclipse but when you do things like run as>> server you have to be on a specific branch of the directory to get this to work because maven's configuration conventions are different from Eclipse.

There are 2 plugins which have to be installed separately:
1) m2Eclipse, this is the maven plugin into eclipse from Sonatype. It allows you to add dependencies, do a maven build and even create new projects. In theory it is ok.
2) WTP, this is a separate plugin which correlates the webtool eclipse project which allows you to create a J2EE Dyanamic webproject to maven.

The Maven command line tool behaves differently than performing the same task in Eclipse. For example let's look at creating a j2ee1.6 project in an attempt to find an archetype which corresponds to an Eclipse Dynamic WebProject with the same webcontent folder structure Eclipse uses for a Dynamic WebProject.

Pick the archetype using either the command line or Eclipse. The descriptions of the archetypes are poor, you have no idea what you are getting because there are so many different types to pick from:

If you use the Eclipse plugin you have a choice of catalogs for archetypes:

There is a tremendous amount of time investment required to figure out which archetype to use and crappy documentation describing the differences in relation to Eclipse project structure.

If you use the Eclipse Plugin you get an error, if you use the Maven command line path followed by a conversion to an Eclipse project using mvn eclipse:eclipse you don't get errors but you get a completely different looking set of files.

Totally Nuts. You get JS folders for the Eclipse version, none for the command line version.

No comments:

Post a Comment