Mavenizing your Liferay project

Preview:

DESCRIPTION

Delivering software in a certain quality and form is always essential for its success. Versioning, packaging, and environment-based deliveries are issues involved with every software project, and these issues are especially crucial when the software consists of multiple components. In this session, we present our own build system based on Maven used for Liferay development. Using the right tools in software projects is essential for keeping certain standards of quality and efficiency, and it also decreases the risk connected with human factor. We introduce how you can leverage from the world's most popular build system, Maven, and use it for your Liferay projects. Common problems like "work on my machine" code, dependency management, or versioning of components will no longer be an issue. A live demo is shown to demonstrate how this tool can be used to cover the whole project's life-cycle including development, testing, integrating Liferay patches, or migration to a higher version.

Citation preview

Mavenizing your Liferay project

April 18th 2012

Presented by

Jan Gregor

…the open source integrator

26.04.2012 2

Presenter Jan Gregor Senior Portal Consultant

• Introductions

• Questions?

• Presenter

26.04.2012 3

Agenda

• Choosing the right build system- Stable and efficient build system is a heart of good software engineering

• Maven & Liferay– Transforming good to perfect

• Live demo - build, deploy and release of real project using Maven

• Next steps – what is planned…

• Q&A

Choosing the right build system

• OOTB Liferay IDE/SDK comes with Ant

• What is wrong with Ant ?

└ Learn the ant tasks (non-standard)

└ Non standard folder structure

└ Integration into existing maven build infrastructure

└ No dependency management

└ No versioning

└ No simple release management

26.04.2012 4

Choosing the right build system

• What is wrong with Ant ?

└ “Works on my machine ” code

└ Machine/User-dependant builds

└ Installation/management effort

└ Inconsistency of developer environments

└ Scalability in big teams

26.04.2012 5

Choosing the right build system

• Impact on project

└ Decrease of quality └ No releasing

└ No dependency management

└ Maintenance & Scalability in future

└ Higher costs └ High effort for each developer setup

└ Delay by WOMM problems….

└ Higher project risk └ Non-standard processes

26.04.2012 6

Choosing the right build system

• Maven

Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:

└ Making the build process easy

└ Providing a uniform build system

└ Providing quality project information

└ Providing guidelines for best practices development

└ Allowing transparent migration to new features

26.04.2012 7

Maven & Liferay

• Need for a maven plugin for Liferay development

└ Liferay Maven plugin └ Official maven support provided by Liferay with focus on copying the

ant-based approach in maven enviroment

└ Mimacom Maven plugin └ Custom maven plugin focused on maximizing potential and

advantages from Maven build system and connecting it with Liferay portal

└ Open source

└ Plugin maven site

26.04.2012 8

Mimacom Maven plugin

• Goal of plugin

└ Wraps the ant scripts with a nice maven facade

└ Use of standard maven project layout

└ No learning effort

└ All maven features are available

└ Produces self contained artifacts, deployable directly on any application server

26.04.2012 9

Mimacom Maven plugin

• Plugin features

└ Standardized and transparent build system

└ Portal customizations without ext

└ Full support of all liferay plugins development

└ Product-like packaging of software

└ Application-server specific builds

└ Migration & dependency management

└ Patch management

26.04.2012 10

Standardized & transparent build

• Project structure with standard maven modules

└ Parent (defines project base configuration) └ Portal (represents Liferay portal)

└ Plugins (represents Liferay plugins)

└ Another modules (can be anything…)

26.04.2012 11

Portal customizations without ext

• Portal as a part of project

└ Standard maven module

└ Opposite of “ext” approach

└ Original and customization on one place └ Always separated

└ Delivered as a black box

└ Built and deployed by maven

└ Live preview in eclipse

26.04.2012 12

Support of all liferay plugins

• Standard maven modules

└ Themes

└ Hooks

└ Plugins

└ Layouts

• Build & deploy to server

• Standard folder structure

• Specific plugin configuration

└ Live preview in eclipse

26.04.2012 13

Product-like packaging

• All components are managed by Maven

└ OOTB Liferay portal

└ Portal customizations

└ Plugins

└ Configuration

└ Libraries

└ Singe point of └ Compile

└ Build

└ Release

└ Delivery

26.04.2012 14

Product-like packaging

• Developing portal customizations

└ “Ext way” └ Separate installation of Application server + Liferay

└ Developing ext-modules and deploying to portal

└ Maven way └ OOTB Portal with all artifacts and dependencies stored in Maven

repository

└ Customizations are made in a maven module

└ By build time the ootb portal + customizations are merged and delivered as a single monolithic package

26.04.2012 15

Product-like packaging

• Developing portal customizations

└ Customizations to └ Portal-impl

└ Portal-web

└ Portal-service

└ Portal configuration

└ 3 delivery artifacts └ Portal war file

└ Portal configuration

└ Portal dependencies

26.04.2012 16

Product-like packaging

• Developing portal-service customizations

└ Using standard maven approach

└ New maven module └ Packaging jar

└ Added portal-service dependencies

└ Overriding classes

└ Finally add to portal module as dependency

└ Configure for automatic deployment into /lib/ext

26.04.2012 17

Product-like packaging

• Delivery artifacts

└ Portal war-file └ Merge ootb + changes

└ Clear separation for developer

└ Transparent delivery for customer

└ Portal dependencies (zip) └ Manageable and configurable

└ Portal configuration (zip) └ Separated config files

└ Manageable and configurable

└ Getting profits from all standard development approaches

26.04.2012 18

Product-like packaging

• Profits

└ All software components managed on a single place

└ Full control of used versions, components, changes

└ Clear separation of customized and original code

└ “Blackbox” delivery of software to a customer without any previous installation of portal

26.04.2012 19

Application-server specific builds

• Common problems

└ Different development / production environments

└ Automatization and control of AS dependent builds

└ Missing auto deploy functionality by some Application servers

26.04.2012 20

Application-server specific builds

• Individual builds for different AS’s

└ Integration with maven profiling

└ Current support of Tomcat & Websphere AS

└ Simulating deployment process in Liferay by build time -> Ensure simple deployment to WAS

└ Live preview in Eclipse

26.04.2012 21

Migration & dependency management

• All artifacts stored in maven repository

└ Portal-web/impl/service

└ Portal dependencies

└ 3rd party libraries

26.04.2012 22

Migration & dependency management

• Installing new Liferay version (Step 1)

└ Download the artifacts └ CE

└ EE (Requires access to Customer portal)

26.04.2012 23

mvn org.mimacom.maven.plugins:maven-liferay-plugin:downloadLiferay -Dversion=6.0.6

mvn org.mimacom.maven.plugins:maven-liferay-plugin:downloadLiferay -Dversion=6.0.11 -DfileVersion=6.0-ee-sp1 -Dusername=XXX -Dpassword=XXX

Migration & dependency management

• Installing new Liferay version (Step 2)

└ Upload the artefacts to maven repository

└ Plugin will automatically upload all artifacts into repository

26.04.2012 24

mvn org.mimacom.maven.plugins:maven-liferay-plugin:deployLiferay -DrepositoryId=mimacom-repo-id-deploy-thirdparty -DrepositoryUrl=${mimacom-deploy-path-thirdparty} -Dversion=5.2.9 -DfileVersion=5.2-ee-sp5 -DserverType=tomcat

Migration & dependency management

• Migrating to newer Liferay version

└ Change the dependency version

└ All dependencies and ootb portal will be automatically updated by build time

└ Possible compile problems and API incompatibility immediately signalized

26.04.2012 25

Patch management

• Profiting from maven dependency management

└ All patches provided by Liferay need to be installed in Maven repository

└ Versioning enables installation of “wrong” patches

└ Internal persistent storage of all provided patches

26.04.2012 26

Patch management

• Integrating patches to project

└ Portal-impl └ Dependencies with scope

compile

└ Portal-service └ Dependencies with scope

compile and moved by plugin to global libraries

└ Portal-web └ Integrated as a maven

module (hook plugin)

└ Portlets └ Integrated a maven module

26.04.2012 27

Next steps

• Support of maven archetypes

• Support of more application servers

• Integration with Liferay IDE and Liferay’s maven support

• Improving product-like documentation & features

• Providing enterprise support

26.04.2012 28

How to start

• Visit plugin maven site

└ http://repo.mimacom.org/content/repositories/mimacom-sites-open/org/mimacom/maven/plugins/1.5.5/org.edorasframework.tools.parent/maven-liferay-plugin/index.html

• Any feedback is very welcome!

26.04.2012 29

31 © mimacom ag 10/21/10

mimacom path

Lösung Idee

Contact

Contact Liferay Free: +49 6196 773 0680 sales-eu@liferay.com

Contact mimacom: International: +41 31 329 09 00 johan.oelen@mimacom.ch

Recommended