Common library path when using liberty maven plugin

388 Views Asked by At

I'm trying to use the open liberty maven plugin. My app has a set of common jars that I define as listed below in the server.xml file. To use the liberty maven plugin I can't use the <application> element (AFAIK) . Can I config a shared library path another way using the maven plugin or ibm-web-ext.xml?

  <library id="commonlibs">
    <fileset dir="C:\dev\commonlibs" includes="*.jar" scanInterval="30s"/>
  </library>

  <application id="irent" location="C:\dev\myapp\myappmaven\target\myapp.war" name="myapp" type="war">
    <classloader commonLibraryRef="commonlibs"/>
    <web-ext enable-file-serving="true"/>
  </application>
1

There are 1 best solutions below

0
On

You should try using the copyDependencies parameter in the Liberty Maven plugin configuration. This is designed to copy over dependencies that are required by your application and place them in a path that makes sense for the server.xml to point to (hardcoded absolute paths are not ideal for server.xml). The default location is the lib/global folder of the target server. The jar files to be copied would need to be located in the local .m2 repository or Maven Central for this to work.

Another option would be to use the maven-dependency-plugin and the copy-dependencies goal.