I spent some hours to figure out how to deploy my webapp to the Liberty from my Maven project.
I looked into the feature restConnector-1.0 . restConnector provides a REST based JMX MBeans interface to WebSphere Liberty. You add <feature>restConnector-1.0</feature> to your server, and make sure you have a user set in the admin role.
You can login and see the various APIs [ https://localhost:9443/IBMJMXConnectorREST/api ] or check the documentation [API1][API2][MBean] . You’ll want to check any upload with https://localhost:9443/IBMJMXConnectorREST/file/status
I used it with maven-antrun-plugin to execute against curl.
As many of you know, I have been working with JAX-RS and WebSphere Liberty for a few years now. Somehow, after this time has passed, I still seem to uncover new JAX-RS capabilities.
For those familiar with JAX-RS, you know it generates some funky errors. I wanted to control the data in the response. I started looking at Servlet Filters, however, by the time you get the response it’s fully committed. I started looking at JAX-RS filters and exception handlers. I found ExceptionMapper and ClientErrorException. The WebSphere Liberty documentation includes a good overview.
I implemented the ExceptionMapper and set a custom response. You could add any of these exceptions – BadRequestException, ForbiddenException, NotAcceptableException, NotAllowedException, NotAuthorizedException, NotFoundException, NotSupportedException. I also added the @Provider annotation to the top of the class, and added a reference in the Application declaration.
I have been working on a project with IIB (IBM Integration Bus). If you are like me, you want to automate all those pesky build tasks. In IIB, I needed to package and build my project (BAR).
I investigated scripting the build using the mqsipackagebar command . I noticed at the bottom a description of using it with ANT.
I’ve used ANT in a few projects (in combination with Maven). I took the script as a starting point, added the jar files and property files (based on configuring environments without IIB). I configured the maven-antrun-plugin in order to integrate within my parent project’s maven build.
Here is some sample code for you, I hope it helps you all get started: