Skip to content
Marat Saitov edited this page Feb 13, 2017 · 56 revisions

Documentation

https://github.com/headwirecom/aemdc

About

AEM Developer Companion (AEMDC) can be used to quickly create any resource in your AEM maven project from predefined templates using the command line or a gui. Currently it is possible to create:

  • templates
  • components
  • editable template structures (since AEM 6.2) with template types
  • content pages
  • osgi configurations
  • java models
  • java services
  • java servlets
  • java filters

Install

Download the last released AEMDC binary ".zip" or "tar.gz" file from (https://github.com/headwirecom/aemdc/releases).

Extract the binary to your tools / "Program Files" directory.

Set the JAVA_HOME and GIT_HOME global ENV variables, as well as the path to AEMDC "bin" folder in the global PATH variable. In Windows it must be under Systems Properties -> Advanced -> Environmental Variables -> User/System Variables. You can also set the PATH in your cmd/cygwin console start command file like:

set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102
set GIT_HOME=C:\Program Files\Git
set AEMDC_HOME=C:\Program Files\aemdc
set PATH=%PATH%;%JAVA_HOME%\bin;%GIT_HOME%\bin;%AEMDC_HOME%\bin

Configuration

To configurate AEMDC go to your parent maven project folder (for example /my-aem-project) and run the command:

aemdc config

aemdc-config.jpg

This command creates an AEMDC configuration file with all possible properties and default values. In case your maven project has been created using AEM Lazybones Template Tool and there is a layzybones properties file then some property values from this file

/my-aem-project/.lazybones/stored-params.properties

will be transfered to the AEMDC configuration file.

/my-aem-project/aemdc-config.properties

Below are all of the possible AEMDC configuration properties available in the current version of AEMDC.

Description Property Name Default
AEMDC Files ROOT folder path for AEMDC templates SOURCE_FOLDER ../aemdc-files
AEMDC Files template types folder path SOURCE_TYPES_FOLDER {{SOURCE_FOLDER}}
Target UI project ROOT folder relative path TARGET_UI_FOLDER ui.apps/src/main/content/jcr_root
Target UI project folder name under /apps TARGET_PROJECT_APPS_FOLDER my-aem-project
Target UI project folder name under /conf TARGET_PROJECT_CONF_FOLDER my-aem-project
Target UI project folder name under /etc/designs TARGET_PROJECT_DESIGN_FOLDER my-aem-project
Target apps project path TARGET_PROJECT_ROOT {{TARGET_UI_FOLDER}}/apps/{{TARGET_PROJECT_APPS_FOLDER}}
Target osgi subfolder under TARGET_PROJECT_ROOT TARGET_OSGI_SUBFOLDER ''
Target CORE project ROOT folder relative path TARGET_JAVA_FOLDER core/src/main/java
Target CORE project JAVA package TARGET_JAVA_PACKAGE com.headwire.myaem.core
Target CORE project JAVA package folder path TARGET_JAVA_PACKAGE_FOLDER {{TARGET_JAVA_FOLDER}}/com/headwire/myaem/core
Target CORE project JAVA Model subpackage name TARGET_JAVA_MODEL_SUBPACKAGE model
Extensions for files with placeholders FILES_WITH_PLACEHOLDERS_EXTENSIONS xml,java,html,jsp,js,css,properties
Forbidden template type names FORBIDDEN_TEMPLATE_TYPES .git,.settings,target,help,.idea
Destination dir/file replacement method (WARN, DELETE, MERGE) EXISTING_DESTINATION_RESOURCES_REPLACEMENT MERGE
AEMDC Log level (ALL,TRACE,DEBUG,INFO,WARN,ERROR,OFF) LOG_LEVEL INFO

All properties can be modified for your needs. Property name can be used as placeholder for definition other property values below it, for example

TARGET_OSGI_SUBFOLDER=/configuration
TARGET_JAVA_FOLDER=core/src/main/java
TARGET_JAVA_PACKAGE_FOLDER={{TARGET_JAVA_FOLDER}}/com/headwire/myaem/core

Templates setup

AEMDC allows the developer to prepare different project patterns with placeholders such as AEMDC Files (https://github.com/headwirecom/aemdc-files) for your future AEM projects and quickly setup a new project structure and contents using a sets of command lines or graphical user interface.

Checkout the templates examples from the next GitHub repository and use them as templates basis for your project.

https://github.com/headwirecom/aemdc-files 

Each template must have a structure as follows:

1. Configuration files.

/<template-type>/config.properties

Example:

# Source folder
SOURCE_TYPE_FOLDER={{SOURCE_TYPES_FOLDER}}/component

# Target folder
TARGET_TYPE_FOLDER={{TARGET_PROJECT_ROOT}}/components

# Command menu: COPY_DIR,COPY_FILE,COPY_FILES,CREATE_FILE_FROM_RESOURCE,REPLACE_PH,REPLACE_PATH_PH,HELP
COMMAND_MENU=COPY_DIR,REPLACE_PH,REPLACE_PATH_PH

# Available template structure: DIR, FILE
TEMPLATE_STRUCTURE=DIR

# Default placeholders
_jcr\:title={{targetname}}
_jcr\:description={{targetname}}
_targetname={{targetname}}
_componentGroup={{TARGET_PROJECT_APPS_FOLDER}}

Template own configuration file which properties have more priority in compare with template type config properties.

/<template-type>/<template-name>/config.properties

Example:

# Source folder
SOURCE_TYPE_FOLDER={{SOURCE_TYPES_FOLDER}}/component/component-js/files/ui.apps/src/main/content/jcr_root/apps/project/components

# Default placeholders
_jcr\:title={{targetname}}Component

Below are all of the possible template configuration properties available in the current version of AEMDC.

Description Mandatory Property Name Default Possible values
Template definition folder path yes SOURCE_TYPE_FOLDER ''
Target folder path yes TARGET_TYPE_FOLDER ''
Command menu list yes COMMAND_MENU '' COPY_DIR, COPY_FILE, COPY_FILES, CREATE_FILE_FROM_RESOURCE, REPLACE_PH, REPLACE_PATH_PH, HELP
Template structure yes TEMPLATE_STRUCTURE DIR DIR, FILE
Default placeholders no _ ''

All properties defined in the aemdc-config.properties such as SOURCE_TYPES_FOLDER for example can be used as placeholders in the template configuration. The reserved placeholders below can be also used in the template configuration file:

{{targetCompModel}}
{{runmode}}

The reserved placeholders below can be used in the template file names/paths:

{{targetname}}
{{targetCompModel}}
{{runmode}}
{{java-class}}

The reserved placeholders below can be used inside of template files:

{{ java-class }}
{{ java-package }}
{{ java-interface-package }}

2. Help for command line options and GUI.

/<template-type>/help/help-type.txt
/<template-type>/help/help-name.txt
/<template-type>/help/help-targetname.txt
/<template-type>/help/help-args.txt
/<template-type>/help/help-gui.txt

Also possible to add templates own help.

/<template-type>/<template-name>/help/help-type.txt
/<template-type>/<template-name>/help/help-name.txt
/<template-type>/<template-name>/help/help-targetname.txt
/<template-type>/<template-name>/help/help-args.txt
/<template-type>/<template-name>/help/help-gui.txt

3. Template files with placeholders.

/<template-type>/<template-name>/files/<path-to-template>/<template-name>/<template files>

For example:

/component/component-js/files/ui.apps/src/main/content/jcr_root/apps/project/components/component-js/.content.xml
/component/component-js/files/ui.apps/src/main/content/jcr_root/apps/project/components/component-js/{{targetname}}.html
/component/component-js/files/ui.apps/src/main/content/jcr_root/apps/project/components/component-js/dialog.xml

How To Use command line tutorial

Command Line Tutorial

How To Use GUI tutorial

GUI Tutorial

Clone this wiki locally