Developing CQ5 Components and OSGi bundles with maven

If you’re starting CQ5 development in multi-developer production environment, it is really useful to be able to generate a new project structure quickly and get code built and deployed to dev instances without too much pain.

Two really convenient archetypes provided by Adobe are simple-content-package-archetype and multimodule-content-package-archetype.

This URL has the details: Archetypes To Generate CQ Projects

Assuming you have maven installed and the following profile installed in your maven settings.xml file.



         <releaseRepository-Name>Adobe Public Releases</releaseRepository-Name>

               <name>Adobe Public Repository</name>

                    <name>Adobe Public Repository</name>

After this, open a commandline and run one of the maven archetype commands in the URL above.


mvn archetype:generate 
-DarchetypeArtifactId=simple-content-package-archetype -DarchetypeVersion=1.0.0 

After putting all the details of your new projects, if you run

mvn clean install

You should get a new CQ5/CRX package created in your target folder. To install this to CQ5, assuming you’re running http://localhost:4502, you need to run install

mvn clean install -PautoInstallPackage

There is a slight problem with the pom.xml generated in that it does not include the CQ5 user and password to be able to install the package. Make the following change to the content/pom.xml file:


Set the variables and crx.pass somewhere in your parent folder’s pom.xml as follows:


Once you do this, running mvn clean install -PautoInstallPackages should deploy (and update) the package in CQ5 successfully.

Having coding!

– Sarwar Bhuiyan

Developing CQ5 Components and OSGi bundles with maven

5 thoughts on “Developing CQ5 Components and OSGi bundles with maven

  1. Tom says:


    Basically I have followed above howto and this is not working as i have received following error that archetype doesnt exists.

    So, please advise…


    [INFO] Archetype defined by properties

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist ( -> [Help 1]

  2. Tom says:

    Please see output using exactly the same command as on the web.

    Please advise…


    [INFO] ————————————————————————
    [INFO] ————————————————————————
    [INFO] Total time: 1.094s
    [INFO] Finished at: Fri Aug 30 20:21:07 CEST 2013
    [INFO] Final Memory: 11M/245M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
    .2:generate (default-cli) on project standalone-pom: The desired archetype does
    not exist ( -> [Help 1]

    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
    rg.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on pro
    ject standalone-pom: The desired archetype does not exist (
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
    at org.apache.maven.DefaultMaven.doExecute(
    at org.apache.maven.DefaultMaven.execute(
    at org.apache.maven.cli.MavenCli.execute(
    at org.apache.maven.cli.MavenCli.doMain(
    at org.apache.maven.cli.MavenCli.main(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    at java.lang.reflect.Method.invoke(
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(
    Caused by: org.apache.maven.plugin.MojoFailureException: The desired archetype d
    oes not exist (
    at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    … 19 more
    Caused by: org.apache.maven.archetype.exception.UnknownArchetype: The desired ar
    chetype does not exist (
    at org.apache.maven.archetype.ui.generation.DefaultArchetypeGenerationCo
    at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu
    … 21 more
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1]

    1. Nivaz Deen says:

      Hi tom,

      please verify whether you have followed the following things.
      1. latest version of mvn.
      2.proper inclusion of which you find in the first part of this page inside settings.xml of your maven (apache-maven-3.1.0\conf\settings.xml). make sure you dint add it in the comment part..

      Nivaz Deen

  3. sandeep kantimahanthi says:

    Hello Sarwar & Niwaz,

    Thanks its working 🙂 …

    Could you also give some example of how to deploy a working bundle onto cq5 ..


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s