Presentation from OpenCms Days 2014.
Every developer beginning to work on OpenCms modules has to find a way to get his resources into the OpenCms VFS. If you're just adding some XSDs and JSPs then cut & paste seems like a viable option. But as soon as websites get more complex and serious programming with custom classes begins, it is time to find a solution that's more efficient and less error prone. If staging and production environments come into the mix, an automated deployment in a version controlled environment seems to be in order.
When we started coding for OpenCms there was no solution we could use out of the box for the CMS team’s IDE of choice, IntelliJ. So we developed our own set of tools that we want to introduce in this session:
- The OpenCms plugin for IntelliJ and its accompanying IDE connector module enable syncing of resources and meta data as well as publishing right from IntelliJ.
- The ModuleManifestGenerator can be used to generate OpenCms module manifests.
- The OpenCms plugin for Maven automates the build, packaging and deployment of OpenCms modules and may be used for continuous integration.
All our tools are Open Source and can be found at GitHub.
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, Maven and Jenkins
1. mediaworx berlin AG
mediaworx berlin 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
2. mediaworx berlin AG
mediaworx berlin .........................................................................................
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
3. mediaworx berlin AG
mediaworx berlin 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
4. mediaworx berlin AG
mediaworx berlin •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
5. mediaworx berlin AG
mediaworx berlin 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
6. mediaworx berlin AG
mediaworx berlin 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
7. mediaworx berlin AG
mediaworx berlin 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
8. mediaworx berlin AG
mediaworx berlin 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
+
9. mediaworx berlin AG
mediaworx berlin •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
10. mediaworx berlin AG
mediaworx berlin 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
11. mediaworx berlin AG
mediaworx berlin 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
12. mediaworx berlin AG
mediaworx berlin 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
13. mediaworx berlin AG
mediaworx berlin 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
14. mediaworx berlin AG
mediaworx berlin 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
15. mediaworx berlin AG
mediaworx berlin 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
16. mediaworx berlin AG
mediaworx berlin 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
17. mediaworx berlin AG
mediaworx berlin 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
18. mediaworx berlin AG
mediaworx berlin 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!
19. mediaworx berlin AG
mediaworx berlin 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.
20. mediaworx berlin AG
mediaworx berlin 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
21. mediaworx berlin AG
mediaworx berlin 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.
22. mediaworx berlin AG
mediaworx berlin 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.
23. mediaworx berlin AG
mediaworx berlin 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
24. mediaworx berlin AG
mediaworx berlin •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
25. mediaworx berlin AG
mediaworx berlin 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
26. mediaworx berlin AG
mediaworx berlin 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
27. mediaworx berlin AG
mediaworx berlin • 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
28. mediaworx berlin AG
mediaworx berlin 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
29. mediaworx berlin AG
mediaworx berlin 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.
30. mediaworx berlin AG
mediaworx berlin <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.
31. mediaworx berlin AG
mediaworx berlin 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
32. mediaworx berlin AG
mediaworx berlin • 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
33. mediaworx berlin AG
mediaworx berlin 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
34. mediaworx berlin AG
mediaworx berlin •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
35. mediaworx berlin AG
mediaworx berlin 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
36. mediaworx berlin AG
mediaworx berlin 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.
37. mediaworx berlin AG
mediaworx berlin 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:
38. mediaworx berlin AG
mediaworx berlin 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
39. mediaworx berlin AG
mediaworx berlin 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
widmann@mediaworx.com
Andreas Karajannis
karajannis@mediaworx.com