Wednesday, June 6, 2007

Maven2 - installing 3rd party JARs

Have a little time these few days, trying to get familiarised with Maven2. Not for work, more for it's own sake, still stuck with a legacy app at work. Been reading about the praises for Maven over Ant but the learning curve for Maven is steeper than Ant. And I'm not sure that the Eclipse plugin is making it easier. Some accidents along the way when running "mvn clean" wiped out the entire webapps folder in Tomcat, not just the test app folder I was anticipating. Thankfully it's a fresh install of Tomcat 6, so it's just the default stuff that came along with it.

Anyway tried to manage some dependencies with Maven, wasn't as fuss-free as it's made out. Tried to compile a simple servlet under eclipse, but I couldn't add the dependency via the Eclipse plugin. Had to add it in manually in pom.xml.

Went to "C:\Documents and Settings\Administrator\.m2\repository" to take a look, looking for servlet-related strings. But not too sure about what I'm looking for so decided to install the JARs that came with Tomcat 6 in the end. Here's the commands I ran.



mvn install:install-file -DgroupId=tomcat -DartifactId=servlet-api -Dversion=6.0.13 -Dfile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar" -Dpackaging=jar



mvn install:install-file -DgroupId=tomcat -DartifactId=jsp-api -Dversion=6.0.13 -Dfile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\jsp-api.jar" -Dpackaging=jar



mvn install:install-file -DgroupId=tomcat -DartifactId=el-api -Dversion=6.0.13 -Dfile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\el-api.jar" -Dpackaging=jar



The Tomcat website has some instructions on using Tomcat libraries with Maven, but I can't figure out how to get Maven to download the libraries from the correct location.

Hang on, actually I do now. The following has to be added into pom.xml

[xml]

tomcat.staging.repos
http://tomcat.apache.org/dev/dist/m2-repository/org/apache


1 comment:

  1. Great mind share on your efforts to manage tomcat lib. dependencies.

    ReplyDelete