Maven Plugin

The CQ Component Plugin requires two Maven configurations. First is the plugin configuration itself. Second is the addition of a Maven dependency containing the annotations used to identify Java Classes as Components and Fields and Methods as authorable elements as well as the abstract classes and interfaces necessary extends the plugin.

Maven POM

<plugin>
    <groupId>com.citytechinc.cq.cq-component-plugin</groupId>
    <artifactId>cq-component-maven-plugin</artifactId>
    <version>6.1.3</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <goals>
                <goal>component</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <componentPathBase>jcr_root/apps/client/components</componentPathBase>
        <componentPathSuffix>content</componentPathSuffix>
        <defaultComponentGroup>Client Group</defaultComponentGroup>
        <transformerName>camel-case</transformerName>
        <generateTouchUiDialogs>true</generateTouchUiDialogs>
        <excludeDependencies>
           <dependency>
               <groupId>dependency.group.id</groupId>
               <artifactId>dependency-artifact-id</artifactId>
           </dependency>
        </excludeDependencies>
        <additionalFeatures>
            <additionalFeature>feature-flag</additionalFeature>
            <additionalFeature>another-feature-flag</additionalFeature>
        </additionalFeatures>
    </configuration>
</plugin>

Maven Dependency

<dependency>
    <groupId>com.citytechinc.cq.cq-component-plugin</groupId>
    <artifactId>cq-component-annotations</artifactId>
    <version>6.1.3</version>
</dependency>

Gradle Plugin

The CQ Component Plugin requires three Gradle configurations. First is the build script configuration to include the plugin. Second is the addition of the componentPlugin extension to set the properties. The third is setting the plugin to depend on a part of the build.

Build Script

buildscript {
    repositories {
       mavenLocal()
       mavenCentral()
    }
    dependencies {
       classpath group: 'com.citytechinc.cq.cq-component-plugin', name: 'cq-component-maven-plugin', version: '6.1.3'
    }
}

componentPlugin Extension

Example

componentPlugin {
    componentPathBase = "jcr_root/apps/project/components"
    componentPathSuffix="content"
    defaultComponentGroup="Project"
    transformerName="camel-case"
}

Depends On

install.dependsOn generateComponents

Configurable Properties

Element Type Default Description
componentPathBase String The content path to your project's components within the apps content tree. The full path to which files for an individual component will be written is: `componentPathBase + / + componentPathSuffix + / + component name` (annotated per component or based on the name of the component class if not annotated). The component path as a whole can be overridden at the component level via the `path` property of the @Component annotation.
componentPathSuffix String content See the description of componentPathBase for an explanation of how this property is used in the construction of a path to which component files will be written.
defaultComponentGroup String The group to which Components whose files are generated via this plugin will be added in the CQ Sidekick. This can be overridden at the component level via the `group` property of the @Component annotation.
transformerName String camel-case The name of the transformer used to change from a the name of a class to the folder in the jcr. The defaults available are:
  • camel-case: Converts the class name to camel case
  • lower-case: Converts the class name to lower case
  • lower-case-dash: Converts the class name to lower case and separates words with dashes. Word boundaries are based on camel case standards.
excludedDependencies List A list of Dependencies whose Components should be excluded from the construction process. XML files will not be generated by this plugin for any Java Classes annotated as Components which are members of any of the Dependencies in this list.

Currently unavailable in the Gradle Plugin.
generateTouchUiDialogs Boolean true Enabled the generation of dialogs for Touch UI
additionalFeatures List A list of Feature Flags for features which should be enabled. See the Additional Features page for more information on this configuration.

Back to top