Include WebSphere runtimes
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 t开发者_开发知识库he jars? I don't need these files in the ear file as they will be available on the server when deployed.
There are two you can accomplish your tasks:
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.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's post above would work, however it would add some additional overhead. We proceeded with Maven Ant tasks (using the maven-ant-tasks jar; http://maven.apache.org/ant-tasks/). This allows us to use our existing build scripts while using dependencies from Maven.
At some point in the near future, we may consider moving entirely to Maven builds, but we found this was an acceptable alternative given our timeline. Hopefully this information proves useful.
精彩评论