mediaworx berlin AG mediaworx berlin AG 1
Welcome! OPENCMS MODULE DEVELOPMENT AND DEPLOYMENT
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
.........................................................................................
About mediaworx
.........................................................................................
The OpenCms Plugin for IntelliJ
.........................................................................................
The OpenCms Plugin for Maven
.........................................................................................
Continuous Integration with Jenkins
.........................................................................................
2
Agenda
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
Digital
Strategy
User
Experience
Performance
Marketing 70 Owner-
managed 1996 High-End
Technology
3
mediaworx berlin AG
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
• CMS projects since 1998
• openworx, in-house developed CMS, PHP
• worked with many CMS systems, among others
• Fatwire Content Server (now Oracle WebCenter Sites)
• TYPO3
• CoreMedia
• imperia
• OpenCms is our main CMS since 2012
• Multiple OpenCms projects for three major clients
• OpenCms is used for mediaworx.com and themed micro sites
4
CMS projects at mediaworx
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG 5 OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms Plugin for IntelliJ
mediaworx berlin AG mediaworx berlin AG
OpenCms is the CMS of choice for mediaworx
• Open Source
• free (as long as OCEE isn’t used)
• developed by a company (as opposed to the community or a
single person)
• Alkacon has been very supportive throughout our projects
• active and supportive community
• constant enhancements through regular updates
• based on standards
• very flexible content type definition with XSD
• highly extensible through custom modules
• content accessible through JSP tags and Java API
• WYSIWYG page editor with drag and drop and inline editing
6
Why we love OpenCms
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
IntelliJ is the CMS team‘s IDE of choice
• great code suggestion and generation features
• loads of refactoring options
• code analysis while typing with the possibility to fix bugs or
“bad code” with a single click
• great code navigation
• very fast full text search even in huge projects
• great Maven integration
• VCS integration
• easy plugin development
• free Community Edition (Open Source)
7
Why we love IntelliJ
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG 8
Our mission: to bring together IntelliJ and OpenCms
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
+
mediaworx berlin AG mediaworx berlin AG
• development started in 2012
• based on a plugin for Fatwire ContentServer, also developed
by mediaworx
• added to the official JetBrains plugin repository in 2014
• Open Source
• used by all our OpenCms developers for all our OpenCms
projects
• constant developer feedback resulting in new and improved
features
9
We proudly present: The OpenCms
plugin for IntelliJ
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG 10
We proudly present: The OpenCms
plugin for IntelliJ
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Integration in IntelliJ
• configuration dialogs in project settings and module
settings
• additional OpenCms menus
• all menu actions accessible by keyboard shortcuts
• OpenCms tool window displaying the plugin’s console
mediaworx berlin AG mediaworx berlin AG 11
We proudly present: The OpenCms
plugin for IntelliJ
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Core Features
• sync of resources between IntelliJ and the OpenCms VFS
• automatic sync of deleted, moved or renamed resources
• export point handling during sync actions
• publishing and auto publish (configurable)
• meta data pull
• manifest generation
• module packaging
mediaworx berlin AG mediaworx berlin AG 12
Configuring the plugin – Project Settings
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms plugin for IntelliJ can be configured for each IntelliJ project, so you
can have different settings for different projects.
The plugin’s project settings dialog
mediaworx berlin AG mediaworx berlin AG 13
Configuring the plugin – Module Settings
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
In IntelliJ’s module settings you can configure your OpenCms modules. It’s
possible to override project default behavior for specific modules.
The plugin’s module settings dialog
mediaworx berlin AG mediaworx berlin AG
OpenCms menus are added
at the following locations:
• in the main menu
• in the project popup menu
• in the editor popup menu
• in the editor tab popup menu
14
Accessing plugin actions – The OpenCms menus
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms menu in the main menu offers all of the plugin’s actions for syncing,
publishing, meta data pulling, manifest generation and module zip packaging
mediaworx berlin AG mediaworx berlin AG
OpenCms menus are added
at the following locations:
• in the main menu
• in the project popup menu
• in the editor popup menu
• in the editor tab popup menu
15
Accessing plugin actions – The OpenCms menus
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms menu in the project popup menu offers actions to
• sync or publish the selected files, folders or modules
• pull meta data, generate manifests or package module zips for selected modules
mediaworx berlin AG mediaworx berlin AG
OpenCms menus are added
at the following locations:
• in the main menu
• in the project popup menu
• in the editor popup menu
• in the editor tab popup menu
16
Accessing plugin actions – The OpenCms menus
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms menu in the editor popup menu offers actions to sync or publish the
file that’s currently open in the editor area
mediaworx berlin AG mediaworx berlin AG
OpenCms menus are added
at the following locations:
• in the main menu
• in the project popup menu
• in the editor popup menu
• in the editor tab popup menu
17
Accessing plugin actions – The OpenCms menus
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms menu in the editor tab popup menu offers actions to
• sync or publish the clicked file
• sync or publish all open tabs
mediaworx berlin AG mediaworx berlin AG 18
Goodbye copy & paste – Now let’s sync!
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
When a resource is synced
• the file is transferred either from the local file system to OpenCms or vice versa
• export points are handled if applicable
• resource meta data is pulled from OpenCms and stored locally
• a direct publish session is started (if auto publish is enabled)
The OpenCms plugin for IntelliJ enables developers to work solely in their IDE by
syncing changes to and from OpenCms. No need to copy & paste!
mediaworx berlin AG mediaworx berlin AG 19
For you to choose – The sync modes
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Push: Local file system is master. All changes to
resources made in OpenCms will be
overwritten by local files (except
properties). VFS resources not existing
locally will be deleted.
Sync: Files are synced to and from the OpenCms
VFS based on their modification date, the
most recent file is synced. That way
changes can be made locally and in
OpenCms.
Pull: All changes made to local files are
overwritten by the corresponding
resources in the OpenCms VFS. Files that
don't exist in the VFS will be deleted from
the local file system.
The OpenCms plugin for IntelliJ offers three different sync modes that can be
configured globally or on a per module basis.
mediaworx berlin AG mediaworx berlin AG
Through OpenCms menu actions you can publish files, folders or modules.
20
Now you can publish right from your IDE
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
If you want you can turn on auto publish, so that every time you sync some files,
a direct publish session containing the updated resources is started.
… or let your IDE publish for you
mediaworx berlin AG mediaworx berlin AG 21
There’s more than files in the VFS – Pulling meta data
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms VFS keeps meta data on resources that can't be stored with the files
in the local file system (e.g. resource IDs, properties). During sync actions that
meta data is pulled and stored as XML files in a separate folder structure.
Resource IDs Properties Access control
XML
In addition to resource meta data, module meta data is pulled and stored for each
module as manifest_stub.xml.
mediaworx berlin AG mediaworx berlin AG 22
But what to do with all that data?
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
File XML Folder XML File XML
Manifest stub XML
Module manifest.xml
File XML ...
• Version control
• Manifest generation
manifest.xml files can be used to package OpenCms module zips from within the
plugin itself or by using the OpenCms plugin for Maven.
mediaworx berlin AG mediaworx berlin AG 23
Packaging module zips for an easy deployment
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms plugin for IntelliJ lets you package your finished modules into
module zips that can then be imported into any OpenCms instance. That way you
you can easily deploy your work to multiple test and production machines.
Production
Staging
mediaworx berlin AG mediaworx berlin AG
• helps avoiding switches between IDE and OpenCms
workplace
• enables version control for OpenCms resources and meta data
• provides meta data for automatic builds of OpenCms modules
• improves our efficiency
• helps us to concentrate on development
• makes developing OpenCms modules more fun
• will be actively developed and enhanced
24
The OpenCms plugin for IntelliJ
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG 25 OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
The OpenCms Plugin for Maven
mediaworx berlin AG mediaworx berlin AG
Maven Objectives
• 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
Maven is a tool for building and managing Java Projects.
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
• Automatic dependency management
• Standardized structure / build process
• Declarative model
• Unittest integration
• Release management
27
We use Maven because:
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
When we began developing for OpenCms, we wanted to use Maven to build
and package our modules.
• Provides the Maven advantages such as dependency management for
OpenCms module development.
• Comes with a custom packaging type "opencms-module“.
• Makes Java dependencies available as standard Maven dependencies.
• Can use static manifests or manifest meta data snippets.
• Manifests can use placeholders such as version directly from your POM.
• The plugin can be used standalone or together with the IntelliJ Plugin.
28
The OpenCms Plugin for Maven
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG 29
Using the plugin
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Your source code is
organized according to the
standard Maven directory
layout.
mediaworx berlin AG mediaworx berlin AG
<project>
<groupId>com.mediaworx.opencms</groupId>
<artifactId>mymodule</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>opencms-module</packaging>
<name>mediaworx OpenCms ${project.artifactId}</name>
<description>mediaworx ${project.artifactId} sample module</description>
<build>
<plugins>
<plugin>
<groupId>com.mediaworx.mojo</groupId>
<artifactId>opencms-maven-plugin</artifactId>
<version>1.2</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.opencms</groupId>
<artifactId>opencms-core</artifactId>
<version>9.0.1</version>
</dependency>
<dependencies>
</project>
30
Using the plugin – POM configuration
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Create a POM for your project,
defining the default Maven
coordinates such as version,
group ID, artifact ID and select
the packaging type „opencms-
module“.
Finally add opencms-core as
dependency to have Maven
collect all the needed jar files.
mediaworx berlin AG mediaworx berlin AG 31 OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Continuous Integration with Jenkins
mediaworx berlin AG mediaworx berlin AG
• Early detection of build failures
• Running codechecks
• Unittests
• Build and deplyoment to development
/ integration or production servers
• Release Mangement
32
Continous Integration and Deployment
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
Why Jenkins?
• Easy to install
• Webbased Configuration
• Many plugins available
• Tight Maven integration
• Can use directory services for authentication
• Distributed builds
33
Jenkins CI Server
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
• We are using our Jenkins CI Server to build our OpenCms modules.
• Deployment of modules to OpenCms servers is also handled by Jenkins
• Deployment Steps
• Build the modules from version control
• Transfer module zips to target system
• Remotely on the target system:
• Stop Tomcat
• Execute cmsshell commands to install the modules
• Start Tomcat
34
Using Jenkins with OpenCms
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
mediaworx berlin AG mediaworx berlin AG
Jenkins
Meta Data
Resources
35 OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Local Dev
Working together …
VCS
Resources
Meta Data
Staging
Production
IntelliJ
mediaworx berlin AG mediaworx berlin AG
OpenCms Plugin for IntelliJ
• Documentation (Project Wiki on GitHub)
• JetBrains plugin repository
• Source code on GitHub
OpenCms Plugin for Maven
• Maven Plugin Documentation
• Maven Repository
OpenCms and mediaworx
36
If you want to find out more …
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
If you’re interested in our Tools, you can find extensive documentation and some
more information on the web.
mediaworx berlin AG mediaworx berlin AG 37
Very special thanks to the participants
of our survey!
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
• Eugen Melnichuk
• Kai Schliemann
• Thomas (Componio)
• Paul-Inge Flakstad
• Fabian Huschka
• Stephan Hartmann
In preparation for this presentation we did a survey on the OpenCms mailing list to
find out how other people are syncing and deploying OpenCms modules. We‘d
like to thank all the people who were willing to share their answers:
mediaworx berlin AG mediaworx berlin AG
Jenkins
Meta Data
Resources
38 OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Local Dev
Questions?
VCS
Resources
Meta Data
Staging
Production
IntelliJ
mediaworx berlin AG mediaworx berlin AG 39
Thank You!
OpenCms Days 2014 | Nov 4 2014 | OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins | Kai Widmann & Andreas Karajannis
Kai Widmann
Andreas Karajannis