© 2018 IBM Corporation
IBM Developer
Open Liberty and Eclipse MicroprofileVideo Series
ibm.biz/OpenLiberty
© 2018 IBM Corporation
Open LibertyAn IBM Open Source Project
Building an Open LibertyApp with Maven
Charles TianSoftware Engineer, Liberty [email protected]
© 2018 IBM Corporation
• Reproducible builds• Dependency management• Open Liberty integration
What is Maven?
Why should I use it?
© 2018 IBM Corporation
Liberty Maven PluginTypical lifecycle definition via parent POMLiberty runtime managementServer configurationFeature managementServer/application lifecycle managementSpring Boot and Arquillian integration
Liberty Maven Plugin repository: https://github.com/WASdev/ci.maven
© 2018 IBM Corporation
Parent POM
Phase Goal
pre-clean stop-server
prepare-package install-servercreate-serverinstall-feature
package install-appspackage-server
pre-integration-test test-start-server
post-integration-test test-stop-server
Parent POM definition: https://github.com/WASdev/ci.maven/blob/master/liberty-maven-app-parent/pom.xml
© 2018 IBM Corporation
Runtime ManagementUsing a Maven artifact:
Runtime installation documentation: https://github.com/WASdev/ci.maven/blob/master/docs/installation-configuration.md
© 2018 IBM Corporation
Runtime Management• Using an existing installation:
Runtime installation documentation: https://github.com/WASdev/ci.maven/blob/master/docs/installation-configuration.md
© 2018 IBM Corporation
Runtime ManagementUsing a packaged runtime:
Runtime installation documentation: https://github.com/WASdev/ci.maven/blob/master/docs/installation-configuration.md
© 2018 IBM Corporation
Server ConfigurationDefine the server name using <serverName>Example:
Server parameters documentation: https://github.com/WASdev/ci.maven/blob/master/docs/common-server-parameters.md
© 2018 IBM Corporation
Feature ManagementDefine the features-bom, feature dependencies,and “install-feature” goal
Server parameters documentation: https://github.com/WASdev/ci.maven/blob/master/docs/common-server-parameters.md
© 2018 IBM Corporation
Server Lifecycle
• run-server (run)*• start-server (start)*• test-start-server• stop-server (stop)*• test-stop-server
Run these goals via the command line using the “liberty” prefix,i.e. “mvn liberty:start-server”
*Shortcuts for these goals are provided in parenthesis. Liberty Maven Pluginversion 2.3 or above is required to use these aliases.
© 2018 IBM Corporation
Application Lifecycle
• install-apps
• deploy
• undeploy
Run these goals via the command line using the “liberty” prefix,
i.e. “mvn liberty:install-apps”
© 2018 IBM Corporation
Third-Party Integrations• Spring Boot• Arquillian
© 2018 IBM Corporation
Putting It All Together• Guide• Project code