Maven2 – installing 3rd party JARs
Posted by project_00 in Java, J2EE, Other IT Stuff Worth Knowing, Software, Web AppsHave 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
<repositories> <repository> <id>tomcat.staging.repos</id> <url>http://tomcat.apache.org/dev/dist/m2-repository/org/apache</url> </repository> </repositories>Tags: Ant, Eclipse, Maven, Tomcat
Related posts:
- Installing PHP 5.2.5 on Windows XP for Tomcat 6.0.13 – Issues resolved I was playing around with the idea of doing a small personal PHP project, and...
- Debugging a JSP compilation problem on Tomcat 6 I was doing some experimentation with Maven and Tomcat 6 when I hit this error....
- EasyEclipse – Free, open source, easy-to-use EasyEclipse – Free, open source, easy-to-use Eclipse distributions and plugins for Windows, Mac and Linux...
- Problem starting Eclipse – JVM terminated. Exit code=1 Just hit this error today, I was able to get Eclipse running just a few...
- Serving static resources in Glassfish 3 I was playing around with the Google Maps API, when I found that I can’t...

Entries (RSS)
Great mind share on your efforts to manage tomcat lib. dependencies.