SlideShare a Scribd company logo
1 of 92
Download to read offline
CQ MAVEN METHODS
CQCON 2013
HELLO WORLD
I'm Andrew.
asavory@adobe.com
@savs
Joined Adobe in November 2012
CQ Newbie
JCR/CMS/TLA old hat
Background in Open Source, Content Management, Mobile
Talking today about what I learned so far...
FORK ME!
If you found this talk useful, or spotted mistakes:
github.com/savs/CQCon_2013_CQ_Maven_Methods
IN YOUR BROWSER
http://goo.gl/qqS1F
SEE ALSO
http://www.planetcq.org/
LET'S BUILD A CQ SITE
... uh, where to begin?
METHOD 1
Enthusiastically rush in, use CRXDE Lite
METHOD 2
I'm a guru, I use Eclipse and CRXDE
METHOD 3
I'm a ninja, I use emacs and vlt
METHOD 4
I'm a guru ninja, I use vi and curl
METHOD 5
See also: http://xkcd.com/378/ – Real Programmers
BUT WHAT ABOUT ...
reverting mistakes?
reproducible builds?
collaborating with others?
deploying to production?
WHY ISN'T IT EASIER TO BUILD A CQ SITE?
Laborious project inception
No two projects alike
Don't know project layout
Don't know project dependencies
Hard for others to reproduce
Hard to test
Lengthy RTFM or worse (no FM)
Documentation over convention
CQ SUCKS
$PRODUCT SUCKS
YOUR METHODOLOGY SUCKS
(sorry)
SO HOW DO WE FIX THIS?
Maven
Git
(or Subversion, or CVS ... ymmv)
Best Practices
MAVEN
“Maven is a software project management
and comprehension tool. Based on the
concept of a project object model (POM),
Maven can manage a project's build,
reporting and documentation from a central
piece of information.”
GIT
“Git is a free and open source distributed
version control system designed to handle
everything from small to very large projects
with speed and efficiency. ”
Version control is a system that records changes to a file or set of files over
time so that you can recall specific versions later.
BEST PRACTICES
“A best practice is a method or technique that
has consistently shown results superior to
those achieved with other means.”
In addition, a "best" practice can evolve to become better as improvements
are discovered.
WHAT DO WE WANT?
Minimal customisation
Standardised way to create a project
Standardised way to build a project
Standardised way to deploy a project
Standardised way to test a project
Standardised way to share a project
OUR TARGET
Success criteria:
IT'S EASY TO BUILD A CQ SITE!
GETTING STARTED
Install Maven: http://maven.apache.org/guides/getting-
started/
Install Git: http://git-scm.com/book/en/Getting-Started-
Installing-Git
CONFIGURING MAVEN
Maven has a settings file that defines things like
repositories where plugins can be downloaded (typically
~/.m2/settings.xml).
We need to add a profile to point to the Adobe repository.
We then specify this repository when we use the
archetype plugin.
See also: Obtaining the Content Package Maven Plugin
CONFIGURING MAVEN
<profile>
<id>adobe-public</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<releaseRepository-Id>adobe-public-releases</releaseRepository-Id>
<releaseRepository-Name>Adobe Public Releases</releaseRepository-Name>
<releaseRepository-URL>http://repo.adobe.com/nexus/content/groups/public</releaseRepository-URL>
</properties>
<repositories>
<repository>
<id>adobe-public-releases</id>
<name>Adobe Basel Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>adobe-public-releases</id>
<name>Adobe Basel Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
CONFIGURING MAVEN
Enable the repository:
Or use the -P option to activate profile(s):
<activeProfiles>
<activeProfile>adobe-public</activeProfile>
</activeProfiles>
mvn -P adobe-public [...]
USING MAVEN
STARTING A NEW PROJECT ...
... can sometimes feel like reinventing the wheel.
YOU ARE HERE
ARCHETYPES
archetype |ˈɑːkɪtʌɪp|
noun
a very typical example of a certain person or thing: he was
the archetype of the old-style football club chairman.
an original which has been imitated; a prototype: an
instrument which was the archetype of the early flute.
MAVEN ARCHETYPES
A prototype upon which others are
copied, patterned, or emulated.
WHAT CQ ARCHETYPES ARE THERE?
simple-content-package
Generates a simple
multimodule-content-package
Includes the folder structure for developing a CQ
application (content package and bundle).
cqblueprints multi-module
Third-party archetype encapsulating best practices for
working with e.g. OSGi bundles, taglibs, and CQ content
See also:
content package
How to work with packages
ON PACKAGES
Packages enable the importing and exporting of repository
content. They are used to install new functionality, transfer
content between instances, or back up the repository
A package is a zip file in file system (vault) serialization
format
Packages include meta information - filter definitions,
import configuration, package properties
Packages are often managed through the CQ
Package Manager
ON BUNDLES
Bundles are modular containers of functionality for OSGi –
essentially a java module that contains application logic
Bundles consist of java classes and other resources needed
to deliver functionality or to provide services to other
bundles.
Bundles can be managed through the CQ
See also:
Web Console
Creating OSGi bundles using CRXDE
HOW TO USE AN ARCHETYPE
archetypeGroupId: identifies the archetype project
uniquely across all projects
archetypeArtifactId: the name of the archetype jar
without a version number
archetypeRepository: where to get the archetype from
(based on pluginRepository in settings.xml)
See also: and
mvn archetype:generate
-DarchetypeGroupId=foo
-DarchetypeArtifactId=bar
-DarchetypeVersion=1.0.0
-DarchetypeRepository=baz
Maven: Introduction to Archetypes Maven: Naming conventions
SIMPLE CONTENT PACKAGE ARCHETYPE
From the fine manual:
“Creates a maven project that is suitable for
installing resources for a simple CQ
application. The folder structure is that used
below the /apps folder of the CQ repository.
The POM defines commands for packaging
the resources that you place in the folders and
installing the packages on the CQ server.”
SIMPLE CONTENT PACKAGE USAGE
archetypeGroupId: com.day.jcr.vault
identifies the archetype project uniquely across all projects
archetypeArtifactId: simple-content-package-archetype
the name of the archetype jar without a version number
archetypeRepository: adobe-public-releases
where to get the archetype from (based on
pluginRepository in settings.xml)
mvn archetype:generate
-DarchetypeGroupId=com.day.jcr.vault
-DarchetypeArtifactId=simple-content-package-archetype
-DarchetypeVersion=1.0.1
-DarchetypeRepository=adobe-public-releases
SIMPLE CONTENT PACKAGE IN ACTION
SIMPLE CONTENT PACKAGE PARAMETERS
groupId: Like a package name, e.g.
com.yourcompany.myproject
artifactId: name of the jar without the version, e.g.
myproject
version: accept the default
package: not used in simple-content-package
appsFolderName: name of /apps/myproject, e.g. myproject
artifactName: Description in Package Manager
packageGroup: Group in Package Manager
See also: Maven: Naming conventions
SIMPLE CONTENT PACKAGE OUTPUT
Template directories
pom.xml file
Instructions for compiling, creating bundles, deploying
to CQ in packages
FileVault configuration files
MULTIMODULE CONTENT PACKAGE USAGE
mvn archetype:generate
-DarchetypeGroupId=com.day.jcr.vault
-DarchetypeArtifactId=multimodule-content-package-archetype
-DarchetypeVersion=1.0.1
-DarchetypeRepository=adobe-public-releases
MULTIMODULE CONTENT PACKAGE OUTPUT
${artifactId}
|- pom.xml
|- bundle
|- pom.xml
|- src
|- main
|- java
|- ${groupId}
|- SimpleDSComponent.java
|- test
|- java
|- ${groupId}
|- SimpleUnitTest.java
|- content
|- pom.xml
|- src
|- main
|- content
|- jcr_root
|- apps
|- ${appsFolderName}
|- config
|- install
|- META-INF
|- vault
|- config.xml
|- filter.xml
|- nodetypes.cnd
|- properties.xml
|- definition
|- .content.xml
CQBLUEPRINTS MULTI-MODULE USAGE
First add the CQ Blueprints Maven Repository to Maven's
settings.xml, then:
archetypeGroupID: com.cqblueprints.archetypes
archetypeArtifactId: multi-module
archetypeVersion: 1.0.5
archetypeRepository: cqblueprints.plugins.releases
See also: and
mvn -P cqblueprints archetype:generate
-DarchetypeGroupId=com.cqblueprints.archetypes
-DarchetypeArtifactId=multi-module
-DarchetypeVersion=1.0.5
-DarchetypeRepository=cqblueprints.plugins.releases
Connecting to the CQ Blueprints Repository The CQ Project Maven Archetype
CQBLUEPRINTS MULTI-MODULE OUTPUT
${artifactId}
|- README
|- pom.xml
|- ${artifactId}-all
|- pom.xml
|- ${artifactId}-config
|- ${artifactId}-content
|- ${artifactId}-services
|- ${artifactId}-taglib
|- ${artifactId}-view
WHY USE CQBLUEPRINTS MULTI-MODULE?
The cqblueprint multi-module archetype is developed by
“The things we wanted to consider with our
archetype is to address concerns of larger
teams”
headwire.com
CQBLUEPRINTS MULTIMODULE DESIGN
foo-view subproject: where css/html/js developers (frontend)
do their work
foo-taglib foo-services: where java developers (backend) do
their work
foo-config: where the configuration (runmode configs stored)
foo-content: how we get initial content and site structure onto
the developer's box quickly
foo-all: how we hand off builds to the next environment
USING GIT
WHY GIT?
Local safety net
"The internet is my backup"
It's good to share
Enlightened self-interest
YOU ARE HERE
GIT PROJECT SETUP
cd projectname
git init
GIT IGNORE
Edit .gitignore, for example:
.classpath
.project
.vlt/
.settings/
target/
GET IT IN GIT
git add *
git commit -m 'Initial project version'
GET IT IN GITHUB (OPTIONAL)
hub-new-repo is a shortcut for creating a repository on
github and pushing your local repo into it
See also:
See also:
cd project
git hub-new-repo
CLI remote github repo creation
github
DEMO
... TIME PASSES ...
COMMIT PROJECT
git add filenames
git commit -m "meaningful message"
git push origin master
(BEST) PRACTICE(S)
YOU ARE HERE
“the three great virtues of a programmer:
laziness, impatience, and hubris”
BUILDING
HOW CAN WE BUILD SMARTER?
Create local zips and jars that you can upload:
mvn package
produces:
Content package output: target/yourapp-content-
1.0-SNAPSHOT.zip
Bundle output: target/testapp-bundle-1.0-
SNAPSHOT.jar
DEPLOYING
HOW CAN WE BUILD AND DEPLOY SMARTER?
Content package: mvn -PautoInstallPackage
install
Bundle: mvn -PautoInstallBundle install
cqblueprints: mvn -Pauto-deploy install
DEMO
DEVELOPING
YOU ARE HERE
How do we develop in a world of maven builds and deploys
and git saves?
THE FILEVAULT TOOL
You can use the FileVault tool (vlt) to check in, check out,
update and sync local content with the repository.
Install: extract crx-
quickstart/opt/filevault/filevault.
[tgz|zip] and add to your path
Usage: vlt --credentials admin:admin co --
force http://localhost:4502/crx
See also: How to use the VLT Tool
SAMPLE DEVELOPMENT WORKFLOW
Use maven to build and deploy
Initialise vlt
Create components, templates with CRXDE Lite
Use vlt to copy back into local filesystem
Change locally
Use vlt to copy back into the repository
Add to git
DEMO
TESTING
CONTINUOUS INTEGRATION?
with ,
as a
with and
Jenkins Git plugin GitHub plugin
Selenium server
Cucumber for java Jenkins plugin tests in java
INTEGRATION TESTING FRAMEWORK
... see Lydia's talk
PRODUCTION
How do we move to production in a world of maven builds and
deploys and git saves?
YOU ARE HERE
MAVEN PROFILE FOR PRODUCTION
Add this to pom.xml:
Deploy using this profile:
Or one-time override: mvn -
Dcrx.host=another.host,crx.port=4504 -
PautoInstallPackage install
See also:
<profile>
<id>auto-deploy-prod</id>
<properties>
<crx.host>production.server.hostname</crx.host>
<crx.port>4502</crx.port>
</properties>
</profile>
mvn -PautoInstallPackage,auto-deploy-prod install
Introduction to build profiles
DEPLOYMENT TESTING
... see Bertrand's talk
PUTTING IT ALL TOGETHER
0-60 IN 5 PSEUDO LINES
mvn archetype:generate
git init; git add *; git commit -m "Initial project"
mvn -PautoInstallPackage install
vlt checkout ; vlt update ; vlt commit
git add; git commit; git push
THANK YOU. QUESTIONS?
CREDITS
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
designed by from The Noun Project
Light Bulb Shane David Kenna
Question Anas Ramadan
Hard Disk Drive Eddie Alshehri
Time wayne25uk
Sync P.J. Onori
Sync Rohith M S
Cloud Upload Adam Whitcroft
Puzzle John O'Shea
Question Henry Ryder
Factory Adrijan Karavdic
Crash Test Dummy Luis Prado

More Related Content

What's hot

GR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug inGR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug in
GR8Conf
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
boyw165
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
Igor Khotin
 

What's hot (20)

An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
GR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug inGR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug in
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Enterprise Maven Repository BOF
Enterprise Maven Repository BOFEnterprise Maven Repository BOF
Enterprise Maven Repository BOF
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developers
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming Language
 
Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
How to be effective with JBoss Developer Studio
How to be effective with JBoss Developer StudioHow to be effective with JBoss Developer Studio
How to be effective with JBoss Developer Studio
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 Overview
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
YouDrup_in_Drupal
YouDrup_in_DrupalYouDrup_in_Drupal
YouDrup_in_Drupal
 
Drupal 8, Where Did the Code Go? From Info Hook to Plugin
Drupal 8, Where Did the Code Go? From Info Hook to PluginDrupal 8, Where Did the Code Go? From Info Hook to Plugin
Drupal 8, Where Did the Code Go? From Info Hook to Plugin
 

Similar to CQ Maven Methods

Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
mfrancis
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
elliando dias
 
Using Maven to build Java & Android program
Using Maven to build Java & Android programUsing Maven to build Java & Android program
Using Maven to build Java & Android program
Mu Chun Wang
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Puppet
 

Similar to CQ Maven Methods (20)

Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGi
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Using Maven2
Using Maven2Using Maven2
Using Maven2
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Using Maven to build Java & Android program
Using Maven to build Java & Android programUsing Maven to build Java & Android program
Using Maven to build Java & Android program
 
Maven
MavenMaven
Maven
 
NUBOMEDIA Webinar
NUBOMEDIA WebinarNUBOMEDIA Webinar
NUBOMEDIA Webinar
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud Run
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
Maven
MavenMaven
Maven
 
Pyramid patterns
Pyramid patternsPyramid patterns
Pyramid patterns
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Spring Lab
Spring LabSpring Lab
Spring Lab
 
Unlocked package
Unlocked packageUnlocked package
Unlocked package
 

More from connectwebex

Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
connectwebex
 
Presentation daniel takai
Presentation daniel takaiPresentation daniel takai
Presentation daniel takai
connectwebex
 
Presentation thomas simlinger
Presentation thomas simlingerPresentation thomas simlinger
Presentation thomas simlinger
connectwebex
 

More from connectwebex (19)

Jackrabbit OCM in practice
Jackrabbit OCM in practiceJackrabbit OCM in practice
Jackrabbit OCM in practice
 
Building Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience ManagerBuilding Creative Product Extensions with Experience Manager
Building Creative Product Extensions with Experience Manager
 
AEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, IntegrationsAEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, Integrations
 
JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
SonarQube for AEM
SonarQube for AEMSonarQube for AEM
SonarQube for AEM
 
Presentation daniel takai
Presentation daniel takaiPresentation daniel takai
Presentation daniel takai
 
Presentation thomas simlinger
Presentation thomas simlingerPresentation thomas simlinger
Presentation thomas simlinger
 
five Sling features you should know
five Sling features you should knowfive Sling features you should know
five Sling features you should know
 
Efficient content structures and queries in CRX/CQ
Efficient content structures and queries in CRX/CQEfficient content structures and queries in CRX/CQ
Efficient content structures and queries in CRX/CQ
 
Web, Mobile, App and Back!
Web, Mobile, App and Back!Web, Mobile, App and Back!
Web, Mobile, App and Back!
 
Tighten your Security and Privacy
Tighten your Security and PrivacyTighten your Security and Privacy
Tighten your Security and Privacy
 
THE BREAK-UP - A user interface love story
THE BREAK-UP - A user interface love storyTHE BREAK-UP - A user interface love story
THE BREAK-UP - A user interface love story
 
Configuring CQ Security
Configuring CQ SecurityConfiguring CQ Security
Configuring CQ Security
 
Integration Testing in AEM
Integration Testing in AEMIntegration Testing in AEM
Integration Testing in AEM
 
Sling Component Filters in CQ5
Sling Component Filters in CQ5 Sling Component Filters in CQ5
Sling Component Filters in CQ5
 
Integrating Backend Systems
Integrating Backend SystemsIntegrating Backend Systems
Integrating Backend Systems
 
Scaling CQ5
Scaling CQ5Scaling CQ5
Scaling CQ5
 
Auto-testing production CQ instances with Muppet
Auto-testing production CQ instances with MuppetAuto-testing production CQ instances with Muppet
Auto-testing production CQ instances with Muppet
 

Recently uploaded

Contact +971581248768 for 100% original and safe abortion pills available for...
Contact +971581248768 for 100% original and safe abortion pills available for...Contact +971581248768 for 100% original and safe abortion pills available for...
Contact +971581248768 for 100% original and safe abortion pills available for...
DUBAI (+971)581248768 BUY ABORTION PILLS IN ABU dhabi...Qatar
 

Recently uploaded (20)

The Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and UncertaintyThe Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and Uncertainty
 
HomeRoots Pitch Deck | Investor Insights | April 2024
HomeRoots Pitch Deck | Investor Insights | April 2024HomeRoots Pitch Deck | Investor Insights | April 2024
HomeRoots Pitch Deck | Investor Insights | April 2024
 
UJJAIN CALL GIRL ❤ 8272964427❤ CALL GIRLS IN UJJAIN ESCORTS SERVICE PROVIDE
UJJAIN CALL GIRL ❤ 8272964427❤ CALL GIRLS IN UJJAIN ESCORTS SERVICE PROVIDEUJJAIN CALL GIRL ❤ 8272964427❤ CALL GIRLS IN UJJAIN ESCORTS SERVICE PROVIDE
UJJAIN CALL GIRL ❤ 8272964427❤ CALL GIRLS IN UJJAIN ESCORTS SERVICE PROVIDE
 
JIND CALL GIRL ❤ 8272964427❤ CALL GIRLS IN JIND ESCORTS SERVICE PROVIDE
JIND CALL GIRL ❤ 8272964427❤ CALL GIRLS IN JIND ESCORTS SERVICE PROVIDEJIND CALL GIRL ❤ 8272964427❤ CALL GIRLS IN JIND ESCORTS SERVICE PROVIDE
JIND CALL GIRL ❤ 8272964427❤ CALL GIRLS IN JIND ESCORTS SERVICE PROVIDE
 
Pimpri Chinchwad Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Servi...
Pimpri Chinchwad Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Servi...Pimpri Chinchwad Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Servi...
Pimpri Chinchwad Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Servi...
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
Berhampur Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Service Avai...
Berhampur Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Service Avai...Berhampur Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Service Avai...
Berhampur Call Girl Just Call♥️ 8084732287 ♥️Top Class Call Girl Service Avai...
 
Contact +971581248768 for 100% original and safe abortion pills available for...
Contact +971581248768 for 100% original and safe abortion pills available for...Contact +971581248768 for 100% original and safe abortion pills available for...
Contact +971581248768 for 100% original and safe abortion pills available for...
 
MEHSANA 💋 Call Girl 9827461493 Call Girls in Escort service book now
MEHSANA 💋 Call Girl 9827461493 Call Girls in  Escort service book nowMEHSANA 💋 Call Girl 9827461493 Call Girls in  Escort service book now
MEHSANA 💋 Call Girl 9827461493 Call Girls in Escort service book now
 
PHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation FinalPHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation Final
 
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 MonthsSEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
 
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow ChallengesFalcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
 
Progress Report - Oracle's OCI Analyst Summit 2024
Progress Report - Oracle's OCI Analyst Summit 2024Progress Report - Oracle's OCI Analyst Summit 2024
Progress Report - Oracle's OCI Analyst Summit 2024
 
Arti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfArti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdf
 
The Vietnam Believer Newsletter_May 13th, 2024_ENVol. 007.pdf
The Vietnam Believer Newsletter_May 13th, 2024_ENVol. 007.pdfThe Vietnam Believer Newsletter_May 13th, 2024_ENVol. 007.pdf
The Vietnam Believer Newsletter_May 13th, 2024_ENVol. 007.pdf
 
PALWAL CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN PALWAL ESCORTS
PALWAL CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN PALWAL ESCORTSPALWAL CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN PALWAL ESCORTS
PALWAL CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN PALWAL ESCORTS
 
10 Influential Leaders Defining the Future of Digital Banking in 2024.pdf
10 Influential Leaders Defining the Future of Digital Banking in 2024.pdf10 Influential Leaders Defining the Future of Digital Banking in 2024.pdf
10 Influential Leaders Defining the Future of Digital Banking in 2024.pdf
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
How does a bike-share company navigate speedy success? - Cyclistic
How does a bike-share company navigate speedy success? - CyclisticHow does a bike-share company navigate speedy success? - Cyclistic
How does a bike-share company navigate speedy success? - Cyclistic
 
WheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond InsightsWheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond Insights
 

CQ Maven Methods

  • 3. Joined Adobe in November 2012
  • 5. Background in Open Source, Content Management, Mobile
  • 6. Talking today about what I learned so far...
  • 7. FORK ME! If you found this talk useful, or spotted mistakes: github.com/savs/CQCon_2013_CQ_Maven_Methods
  • 10.
  • 11.
  • 12. LET'S BUILD A CQ SITE ... uh, where to begin?
  • 13. METHOD 1 Enthusiastically rush in, use CRXDE Lite
  • 14. METHOD 2 I'm a guru, I use Eclipse and CRXDE
  • 15. METHOD 3 I'm a ninja, I use emacs and vlt
  • 16. METHOD 4 I'm a guru ninja, I use vi and curl
  • 17. METHOD 5 See also: http://xkcd.com/378/ – Real Programmers
  • 18. BUT WHAT ABOUT ... reverting mistakes? reproducible builds? collaborating with others? deploying to production?
  • 19. WHY ISN'T IT EASIER TO BUILD A CQ SITE? Laborious project inception No two projects alike Don't know project layout Don't know project dependencies Hard for others to reproduce Hard to test Lengthy RTFM or worse (no FM) Documentation over convention
  • 23. SO HOW DO WE FIX THIS? Maven Git (or Subversion, or CVS ... ymmv) Best Practices
  • 24. MAVEN “Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.”
  • 25. GIT “Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. ” Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
  • 26. BEST PRACTICES “A best practice is a method or technique that has consistently shown results superior to those achieved with other means.” In addition, a "best" practice can evolve to become better as improvements are discovered.
  • 27. WHAT DO WE WANT? Minimal customisation Standardised way to create a project Standardised way to build a project Standardised way to deploy a project Standardised way to test a project Standardised way to share a project
  • 29. Success criteria: IT'S EASY TO BUILD A CQ SITE!
  • 30. GETTING STARTED Install Maven: http://maven.apache.org/guides/getting- started/ Install Git: http://git-scm.com/book/en/Getting-Started- Installing-Git
  • 31. CONFIGURING MAVEN Maven has a settings file that defines things like repositories where plugins can be downloaded (typically ~/.m2/settings.xml). We need to add a profile to point to the Adobe repository. We then specify this repository when we use the archetype plugin. See also: Obtaining the Content Package Maven Plugin
  • 32. CONFIGURING MAVEN <profile> <id>adobe-public</id> <activation> <activeByDefault>false</activeByDefault> </activation> <properties> <releaseRepository-Id>adobe-public-releases</releaseRepository-Id> <releaseRepository-Name>Adobe Public Releases</releaseRepository-Name> <releaseRepository-URL>http://repo.adobe.com/nexus/content/groups/public</releaseRepository-URL> </properties> <repositories> <repository> <id>adobe-public-releases</id> <name>Adobe Basel Public Repository</name> <url>http://repo.adobe.com/nexus/content/groups/public</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>adobe-public-releases</id> <name>Adobe Basel Public Repository</name> <url>http://repo.adobe.com/nexus/content/groups/public</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>
  • 33. CONFIGURING MAVEN Enable the repository: Or use the -P option to activate profile(s): <activeProfiles> <activeProfile>adobe-public</activeProfile> </activeProfiles> mvn -P adobe-public [...]
  • 35. STARTING A NEW PROJECT ... ... can sometimes feel like reinventing the wheel.
  • 37. ARCHETYPES archetype |ˈɑːkɪtʌɪp| noun a very typical example of a certain person or thing: he was the archetype of the old-style football club chairman. an original which has been imitated; a prototype: an instrument which was the archetype of the early flute.
  • 38. MAVEN ARCHETYPES A prototype upon which others are copied, patterned, or emulated.
  • 39. WHAT CQ ARCHETYPES ARE THERE? simple-content-package Generates a simple multimodule-content-package Includes the folder structure for developing a CQ application (content package and bundle). cqblueprints multi-module Third-party archetype encapsulating best practices for working with e.g. OSGi bundles, taglibs, and CQ content See also: content package How to work with packages
  • 40. ON PACKAGES Packages enable the importing and exporting of repository content. They are used to install new functionality, transfer content between instances, or back up the repository A package is a zip file in file system (vault) serialization format Packages include meta information - filter definitions, import configuration, package properties Packages are often managed through the CQ Package Manager
  • 41. ON BUNDLES Bundles are modular containers of functionality for OSGi – essentially a java module that contains application logic Bundles consist of java classes and other resources needed to deliver functionality or to provide services to other bundles. Bundles can be managed through the CQ See also: Web Console Creating OSGi bundles using CRXDE
  • 42. HOW TO USE AN ARCHETYPE archetypeGroupId: identifies the archetype project uniquely across all projects archetypeArtifactId: the name of the archetype jar without a version number archetypeRepository: where to get the archetype from (based on pluginRepository in settings.xml) See also: and mvn archetype:generate -DarchetypeGroupId=foo -DarchetypeArtifactId=bar -DarchetypeVersion=1.0.0 -DarchetypeRepository=baz Maven: Introduction to Archetypes Maven: Naming conventions
  • 43. SIMPLE CONTENT PACKAGE ARCHETYPE From the fine manual: “Creates a maven project that is suitable for installing resources for a simple CQ application. The folder structure is that used below the /apps folder of the CQ repository. The POM defines commands for packaging the resources that you place in the folders and installing the packages on the CQ server.”
  • 44. SIMPLE CONTENT PACKAGE USAGE archetypeGroupId: com.day.jcr.vault identifies the archetype project uniquely across all projects archetypeArtifactId: simple-content-package-archetype the name of the archetype jar without a version number archetypeRepository: adobe-public-releases where to get the archetype from (based on pluginRepository in settings.xml) mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=simple-content-package-archetype -DarchetypeVersion=1.0.1 -DarchetypeRepository=adobe-public-releases
  • 46. SIMPLE CONTENT PACKAGE PARAMETERS groupId: Like a package name, e.g. com.yourcompany.myproject artifactId: name of the jar without the version, e.g. myproject version: accept the default package: not used in simple-content-package appsFolderName: name of /apps/myproject, e.g. myproject artifactName: Description in Package Manager packageGroup: Group in Package Manager See also: Maven: Naming conventions
  • 47. SIMPLE CONTENT PACKAGE OUTPUT Template directories pom.xml file Instructions for compiling, creating bundles, deploying to CQ in packages FileVault configuration files
  • 48. MULTIMODULE CONTENT PACKAGE USAGE mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.1 -DarchetypeRepository=adobe-public-releases
  • 49. MULTIMODULE CONTENT PACKAGE OUTPUT ${artifactId} |- pom.xml |- bundle |- pom.xml |- src |- main |- java |- ${groupId} |- SimpleDSComponent.java |- test |- java |- ${groupId} |- SimpleUnitTest.java |- content |- pom.xml |- src |- main |- content |- jcr_root |- apps |- ${appsFolderName} |- config |- install |- META-INF |- vault |- config.xml
  • 50. |- filter.xml |- nodetypes.cnd |- properties.xml |- definition |- .content.xml
  • 51. CQBLUEPRINTS MULTI-MODULE USAGE First add the CQ Blueprints Maven Repository to Maven's settings.xml, then: archetypeGroupID: com.cqblueprints.archetypes archetypeArtifactId: multi-module archetypeVersion: 1.0.5 archetypeRepository: cqblueprints.plugins.releases See also: and mvn -P cqblueprints archetype:generate -DarchetypeGroupId=com.cqblueprints.archetypes -DarchetypeArtifactId=multi-module -DarchetypeVersion=1.0.5 -DarchetypeRepository=cqblueprints.plugins.releases Connecting to the CQ Blueprints Repository The CQ Project Maven Archetype
  • 52. CQBLUEPRINTS MULTI-MODULE OUTPUT ${artifactId} |- README |- pom.xml |- ${artifactId}-all |- pom.xml |- ${artifactId}-config |- ${artifactId}-content |- ${artifactId}-services |- ${artifactId}-taglib |- ${artifactId}-view
  • 53. WHY USE CQBLUEPRINTS MULTI-MODULE? The cqblueprint multi-module archetype is developed by “The things we wanted to consider with our archetype is to address concerns of larger teams” headwire.com
  • 54. CQBLUEPRINTS MULTIMODULE DESIGN foo-view subproject: where css/html/js developers (frontend) do their work foo-taglib foo-services: where java developers (backend) do their work foo-config: where the configuration (runmode configs stored) foo-content: how we get initial content and site structure onto the developer's box quickly foo-all: how we hand off builds to the next environment
  • 56. WHY GIT? Local safety net "The internet is my backup" It's good to share Enlightened self-interest
  • 58. GIT PROJECT SETUP cd projectname git init
  • 59. GIT IGNORE Edit .gitignore, for example: .classpath .project .vlt/ .settings/ target/
  • 60. GET IT IN GIT git add * git commit -m 'Initial project version'
  • 61. GET IT IN GITHUB (OPTIONAL) hub-new-repo is a shortcut for creating a repository on github and pushing your local repo into it See also: See also: cd project git hub-new-repo CLI remote github repo creation github
  • 62. DEMO
  • 64. COMMIT PROJECT git add filenames git commit -m "meaningful message" git push origin master
  • 67. “the three great virtues of a programmer: laziness, impatience, and hubris”
  • 68.
  • 70. HOW CAN WE BUILD SMARTER? Create local zips and jars that you can upload: mvn package produces: Content package output: target/yourapp-content- 1.0-SNAPSHOT.zip Bundle output: target/testapp-bundle-1.0- SNAPSHOT.jar
  • 72. HOW CAN WE BUILD AND DEPLOY SMARTER? Content package: mvn -PautoInstallPackage install Bundle: mvn -PautoInstallBundle install cqblueprints: mvn -Pauto-deploy install
  • 73. DEMO
  • 76. How do we develop in a world of maven builds and deploys and git saves?
  • 77. THE FILEVAULT TOOL You can use the FileVault tool (vlt) to check in, check out, update and sync local content with the repository. Install: extract crx- quickstart/opt/filevault/filevault. [tgz|zip] and add to your path Usage: vlt --credentials admin:admin co -- force http://localhost:4502/crx See also: How to use the VLT Tool
  • 78. SAMPLE DEVELOPMENT WORKFLOW Use maven to build and deploy Initialise vlt Create components, templates with CRXDE Lite Use vlt to copy back into local filesystem Change locally Use vlt to copy back into the repository Add to git
  • 79. DEMO
  • 81. CONTINUOUS INTEGRATION? with , as a with and Jenkins Git plugin GitHub plugin Selenium server Cucumber for java Jenkins plugin tests in java
  • 84. How do we move to production in a world of maven builds and deploys and git saves?
  • 86. MAVEN PROFILE FOR PRODUCTION Add this to pom.xml: Deploy using this profile: Or one-time override: mvn - Dcrx.host=another.host,crx.port=4504 - PautoInstallPackage install See also: <profile> <id>auto-deploy-prod</id> <properties> <crx.host>production.server.hostname</crx.host> <crx.port>4502</crx.port> </properties> </profile> mvn -PautoInstallPackage,auto-deploy-prod install Introduction to build profiles
  • 87. DEPLOYMENT TESTING ... see Bertrand's talk
  • 88. PUTTING IT ALL TOGETHER
  • 89. 0-60 IN 5 PSEUDO LINES mvn archetype:generate git init; git add *; git commit -m "Initial project" mvn -PautoInstallPackage install vlt checkout ; vlt update ; vlt commit git add; git commit; git push
  • 90.
  • 92. CREDITS designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project designed by from The Noun Project Light Bulb Shane David Kenna Question Anas Ramadan Hard Disk Drive Eddie Alshehri Time wayne25uk Sync P.J. Onori Sync Rohith M S Cloud Upload Adam Whitcroft Puzzle John O'Shea Question Henry Ryder Factory Adrijan Karavdic Crash Test Dummy Luis Prado