Setup
- Maven EAR project
- OpenLiberty plugin for local test deployment in a Liberty server
Behaviour of the plugin
The plugin deploys an XML file which aggregates a list and links to required runtime jars, instead of building an EAR file -- so far, so good, the application starts and runs.
Issue
However, some dependencies in the project have colliding transitive dependencies and the pom.xml contains a lot of exclusions. Unfortunately, those exlusions are ignored by the plugin and the application encounters runtime issues due to the aformentioned clashes (ClassNotFoundException etc.). Those -- of course -- do not occur, if one drops in the EAR file.
Questions
- Is there a possibility to fix this issue and make the *.ear.xml contain those exclusions?
- If not, is there a possibility to explicitly make the plugin build and use the EAR artifact instead of the implicitly generated xml file?
Bypassing "loose application" and generating a normal archive file
To answer one part of your question, you can configure the liberty-maven-plugin to deploy the full binary archive (WAR or EAR) rather than use the XML-defined representation via the
<looseApplication>false</looseApplication>
parameter on your liberty-maven-plugin configuration:This will be less convenient for iterative development, since you have to do a full "package" and then another "deploy" rather than only having to do another "compile", but it would be a way to work around the issue you discovered.
Follow-up
As far as the issue with the liberty-maven-plugin not handling exclusions in building the loose application XML file, I suggest opening an issue in the liberty-maven-plugin GitHub repo (https://github.com/OpenLiberty/ci.maven/) and I'll update this when we have one.