tags:

views:

9

answers:

2

What's the best way to include the WebSphere runtimes when building a ear file using Maven? Using ant, I just added the absolute path to the lib directory in the classpath. What I've read on the subject, it seems like people say to use system scoped dependencies. For this, however, I need to include each jar independently (and there is a good number of jars in the WebSphere runtime).

Is there a way to include just the absolute path to all the jars? I don't need these files in the ear file as they will be available on the server when deployed.

+1  A: 

There are two you can accomplish your tasks:

  1. As you suggested, you can declare the dependency as a system scoped dependency and provide a path to the the JAR file. While maven requires those dependencies to be absolute, it also defined the runtime property ${basedir} that already resolves to where the POM file is located.

  2. You could add the JAR files to a local maven repository server (Nexus, Archiva, etc) and then declare the dependency scope as provided. This will pull the JAR files down to the machine for compiling and testing but excludes them from the package at the end.

I've done both methods and the system scoped technique gets old especially when you add a JAR that also has dependencies. With system scoped, you loose the transitive dependency resolution function of maven. Yet if the app is small and 1 or 2 devs, the overhead of a repository sever doesn't make much sense.

Dan