I've been using Maven a bit for my "day job", converting a multi-module Ant build over to Maven. Since I just pushed out Tapestry 5.0.5 (awaiting a release vote), it seemed like a good time to look at upgrading to Maven 2.0.7.
The "day job" work has shown that having a traditionally stuctured aggregate project is viable even when using Eclipse. The Maven plugin for Eclipse is smart enough to read the parent POM as well as the child POM's in each module when building the overall classpath. I expect to restucture Tapestry 5 this way pretty soon, which will make it even easier to checkout and build the code than today. This structure, as a single mega-project, will make things easier when refactoring across module boundaries (a pain to do today, when using multiple Eclipse projects). However, the command line build will be very important, as it will catch some dependency issues that the Eclipse build will not.
Speaking of which ... Maven 2.0.7 (and 2.0.6 I believe) has tweaked dependencies. I had a couple of "runtime" scope dependencies inherited from tapestry-ioc to tapestry-core. These compiled fine in 2.0.5 but need to be changed in 2.0.7 to compile. In my case, since javassist was a "runtime" scope in tapestry-ioc, none of the javassist classes were visible when compiling tapestry-core.
A handy tool inside Maven for diagnosing this is the dependency plugin:
$ mvn dependency:resolve [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'dependency'. [INFO] org.apache.maven.plugins: checking for updates from tapestry [INFO] org.apache.maven.plugins: checking for updates from howardlewisship.com [INFO] org.apache.maven.plugins: checking for updates from codehaus.snapshots [INFO] org.codehaus.mojo: checking for updates from tapestry [INFO] org.codehaus.mojo: checking for updates from howardlewisship.com [INFO] org.codehaus.mojo: checking for updates from codehaus.snapshots [INFO] artifact org.apache.maven.plugins:maven-dependency-plugin: checking for updates from tapestry [INFO] artifact org.apache.maven.plugins:maven-dependency-plugin: checking for updates from howardlewisship.com [INFO] artifact org.apache.maven.plugins:maven-dependency-plugin: checking for updates from codehaus.snapshots [INFO] ---------------------------------------------------------------------------- [INFO] Building Tapestry Core Library [INFO] task-segment: [dependency:resolve] [INFO] ---------------------------------------------------------------------------- [INFO] [dependency:resolve] [INFO] [INFO] The following files have been resolved: [INFO] commons-codec:commons-codec:jar:1.3 (scope = compile) [INFO] commons-logging:commons-logging:jar:1.0.4 (scope = compile) [INFO] javax.servlet:servlet-api:jar:2.4 (scope = provided) [INFO] jboss:javassist:jar:3.4.ga (scope = runtime) [INFO] junit:junit:jar:3.8.1 (scope = provided) [INFO] log4j:log4j:jar:1.2.9 (scope = test) [INFO] org.apache.tapestry:tapestry-ioc:jar:5.0.5 (scope = compile) [INFO] org.apache.tapestry:tapestry-test:jar:5.0.5 (scope = provided) [INFO] org.easymock:easymock:jar:2.2 (scope = provided) [INFO] org.openqa.selenium.client-drivers:selenium-java-client-driver:jar:0.8.1 (scope = provided) [INFO] org.openqa.selenium.server:selenium-server:jar:0.8.1 (scope = provided) [INFO] org.testng:testng:jar:jdk15:5.1 (scope = provided) [INFO] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Sat Jun 30 00:20:31 PDT 2007 [INFO] Final Memory: 4M/9M [INFO] ------------------------------------------------------------------------ ~/workspace/tapestry-core $
5 comments:
In case you didn't already know:
When you build IDEA project files using mvn idea:idea, the modules within the project are linked as dependencies. They're not pointing to your local maven repository, so there's no need to constantly run "mvn install" to update dependency implementations. And you can refactor across multiple modules within the same project.
Exactly the same experience, I need to add commons-collections to almost all of my subprojects since it is no longer automatically (inherently) there.
I think it's a good move from maven side to make dependencies strictly explicit hence generating better dependencies reports in the end.
i think there is a bug in 2.0.5 that disables maven to find the right plugin from its shortname.
using the fully-qualified name should work:
>mvn org.apache.maven.plugins:maven-dep
endency-plugin:resolve
Version 0.0.10 of the Maven plugin for eclipse will refer to any modules checked out into the same workspace as project-references, which makes refactoring a lot easier.
Is this is the solution for my Java Web App that when packaged to WAR using mvn package can not have all the reqs library inside it resulting .WAR?
I'll try tough
Post a Comment