Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Adding a pre-requisites module and core components #38

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Below are all of the options available in the current version. To specify an opt
| Dispatcher Artifact ID | example-project.dispatcher | dispatcherArtifactId |
| Folder to create under `/apps` | my-aem-project | appsFolderName |
| Folder to use under `/content` | my-aem-project | contentFolderName |
| Include a module for pre-requisite packages and bundles? | no | generatePrereqArtifact |
| Include Core components as a dependency? | yes | includeCoreComponents |
| Pre-requisites Artifact ID | example-project.prereqs | prereqArtifactId |
| Folder name under `/apps` for pre-requisites | my-aem-project-prereqs | appsPrereqFolderName |
| Create AEM Editable Templates folders? | yes | createEditableTemplatesStructure |
| Folder to create under `/conf` | my-aem-project | confFolderName |
| Create a site design? | no | createDesign |
Expand Down
41 changes: 38 additions & 3 deletions templates/aem-multimodule-project/lazybones.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def props = [:]
props.rootDependencies = []
props.bundleDependencies = []
props.contentDependencies = []
props.prereqDependencies = []

// common dependencies
def osgiCore = dependency("org.osgi", "osgi.core", "6.0.0")
Expand All @@ -108,7 +109,8 @@ props.bundleDependencies.addAll([osgiCore, osgiCompendium, osgiAnnotations, osgi
props.contentDependencies.addAll([osgiCore, osgiCompendium, servletApi, commonsLang3, jstl, jsp, jcr, slf4j])

// Constants
def ACS_AEM_COMMONS_VERSION = "3.14.10"
def ACS_AEM_COMMONS_VERSION = "3.18.2"
def CORE_COMPONENTS_VERSION = "2.2.0"
def AEM63_API_VERSION = "6.3.0"
def AEM64_API_VERSION = "6.4.0"

Expand All @@ -127,8 +129,8 @@ props.contentArtifactId = ask("Maven artifact ID for the generated content packa
props.version = ask("Maven version for generated project [0.0.1-SNAPSHOT]: ", "0.0.1-SNAPSHOT", "version")
props.projectName = ask("Human readable project name [My AEM Project]: ", "My AEM Project", "projectName")
props.packageGroup = ask("Group name for Content Package [my-packages]: ", "my-packages", "packageGroup")
props.aemVersion = askFromList("Target AEM version [${VERSION_63}]: ", VERSION_63, "aemVersion", [VERSION_63, VERSION_64])
props.generateDispatcherArtifact = askBoolean("Include a module to generate dispatcher configuration zip? [no]: ", "no", "generateDispatcherArtifact")
props.aemVersion = askFromList("Target AEM version [${VERSION_64}]: ", VERSION_64, "aemVersion", [VERSION_63, VERSION_64])
def defaultDispatcherArtifactId = "${props.artifactId}.dispatcher";
if (props.generateDispatcherArtifact) {
props.dispatcherArtifactId = ask("Maven artifact ID for the generated dispatcher module [${defaultDispatcherArtifactId}]: ", defaultDispatcherArtifactId as String, "dispatcherArtifactId")
Expand Down Expand Up @@ -156,6 +158,16 @@ def defaultFolderName = transformText(props.projectName, from: NameType.NATURAL,
props.appsFolderName = ask("Folder name under /apps for components and templates [${defaultFolderName}]: ", defaultFolderName, "appsFolderName")
props.contentFolderName = ask("Folder name under /content which will contain your site [${defaultFolderName}] (Don't worry, you can always add more, this is just for some default configuration.): ", defaultFolderName, "contentFolderName")

props.generatePrereqArtifact = askBoolean("Include a module for pre-requisite packages and bundles? [no]: ", "no", "generatePrereqArtifact")
if (props.generatePrereqArtifact) {
def defaultPrereqArtifactId = "${props.artifactId}${props.useNewNamingConvention ? '.prereqs' : '-prereqs'}";
props.prereqArtifactId = ask("Maven artifact ID for the generated pre-requisites content package module [${defaultPrereqArtifactId}]: ", defaultPrereqArtifactId as String, "prereqArtifactId")
def defaultPrereqFolderName = "${defaultFolderName}-prereqs"
props.appsPrereqFolderName = ask("Folder name under /apps for pre-requisites [${defaultPrereqFolderName}]: ", defaultPrereqFolderName, "appsPrereqFolderName")
} else {
new File(projectDir, "prereqs").deleteDir()
}

// Create Editable Templates folders?
props.createEditableTemplatesStructure = askBoolean("Would you like to create AEM Editable Templates folders? [yes]: ", "yes", "createEditableTemplatesStructure");

Expand Down Expand Up @@ -198,6 +210,18 @@ if (createEnvRunModeConfigFolders) {
createAuthorAndPublishPerEnv = askBoolean("Create author and publish runmode directories per environment? [yes]: ", "yes", "createAuthorAndPublishPerEnv")
}

// Core components
props.includeCoreComponents = askBoolean("Include Core components as a dependency? [yes]: ", "yes", "includeCoreComponents")
if (props.includeCoreComponents) {
def content = dependency("com.adobe.cq", "core.wcm.components.all", CORE_COMPONENTS_VERSION, "zip", "provided", "")
props.rootDependencies.add(content)
if (props.generatePrereqArtifact) {
props.prereqDependencies.add(content)
} else {
props.contentDependencies.add(content)
}
}

// ACS AEM Commons
props.includeAcsAemCommons = askBoolean("Include ACS AEM Commons as a dependency? [yes]: ", "yes", "includeAcsAemCommons")
if (props.includeAcsAemCommons) {
Expand All @@ -212,7 +236,11 @@ if (props.includeAcsAemCommons) {
if (props.includeAcsAemCommonsSubPackage) {
def content = dependency("com.adobe.acs", "acs-aem-commons-content", ACS_AEM_COMMONS_VERSION, "content-package", "provided", props.includeAcsAemCommonsMinPackage ? "min" : "")
props.rootDependencies.add(content)
props.contentDependencies.add(content)
if (props.generatePrereqArtifact) {
props.prereqDependencies.add(content)
} else {
props.contentDependencies.add(content)
}
}
props.enableErrorHandler = askBoolean("Do you want to enable the ACS AEM Commons Error Handler? [yes]: ", "yes", "enableErrorHandler")

Expand Down Expand Up @@ -261,6 +289,13 @@ processTemplates "ui.apps/src/main/content/META-INF/vault/properties.xml", props
processTemplates "ui.apps/src/main/content/META-INF/vault/filter.xml", props
processTemplates "ui.apps/src/main/content/META-INF/vault/definition/.content.xml", props

if (props.generatePrereqArtifact) {
println "Processing pre-requisite package metafiles..."
processTemplates "prereqs/src/main/content/META-INF/vault/properties.xml", props
processTemplates "prereqs/src/main/content/META-INF/vault/filter.xml", props
processTemplates "prereqs/src/main/content/META-INF/vault/definition/.content.xml", props
}

println "Creating folders..."
def componentsDir = new File(projectDir, "ui.apps/src/main/content/jcr_root/apps/${props.appsFolderName}/components")
componentsDir.mkdirs()
Expand Down
3 changes: 3 additions & 0 deletions templates/aem-multimodule-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@
<% } %>
</profiles>
<modules>
<% if (generatePrereqArtifact) { %>
<module>prereqs</module>
<% } %>
<module>${bundleInBundlesDirectory ? 'bundles/' : ''}${useNewNamingConvention ? 'core' : 'bundle'}</module>
<module>${useNewNamingConvention ? 'ui.apps' : 'content'}</module>
<% if (generateDispatcherArtifact) { %>
Expand Down
136 changes: 136 additions & 0 deletions templates/aem-multimodule-project/prereqs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- ====================================================================== -->
<!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<parent>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</parent>

<!-- ====================================================================== -->
<!-- P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->

<artifactId>${prereqArtifactId}</artifactId>
<packaging>content-package</packaging>
<name>${projectName} Pre-requisites Content Package</name>

<dependencies><%
%><% for (dependency in prereqDependencies) { %>
<dependency>
<groupId>${dependency.groupId}</groupId>
<artifactId>${dependency.artifactId}</artifactId><%
%><% if (dependency.type != "jar") { %>
<type>${dependency.type}</type><%
%><% }
if (dependency.classifier) { %>
<classifier>${dependency.classifier}</classifier><%
%><% } %>
</dependency><%
%><% } %>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/content/jcr_root</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/.vlt</exclude>
<exclude>**/.vltignore</exclude>
</excludes>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<includeEmptyDirs>true</includeEmptyDirs>
</configuration>
</plugin>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<group>${packageGroup}</group>
<filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
<embeddeds>
</embeddeds>
<subPackages>
<% if (includeAcsAemCommons && includeAcsAemCommonsSubPackage) {%>
<subPackage>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons-content</artifactId>
<filter>true</filter>
</subPackage>
<% } %>
<% if (includeCoreComponents) {%>
<subPackage>
<groupId>com.adobe.cq</groupId>
<artifactId>core.wcm.components.all</artifactId>
<filter>true</filter>
</subPackage>
<% } %>
</subPackages>
<targetURL>http://\${crx.host}:\${crx.port}/crx/packmgr/service.jsp</targetURL>
<properties>
<acHandling>merge_preserve</acHandling>
</properties>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>autoInstallPackage</id>
<build>
<plugins>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<executions>
<execution>
<id>install-content-package</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>autoInstallPackagePublish</id>
<build>
<plugins>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<executions>
<execution>
<id>install-content-package-publish</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
<configuration>
<targetURL>http://\${publish.crx.host}:\${publish.crx.port}/crx/packmgr/service.jsp</targetURL>
<userId>\${publish.crx.username}</userId>
<password>\${publish.crx.password}</password>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<vaultfs version="1.1">
<!--
Defines the content aggregation. The order of the defined aggregates
is important for finding the correct aggregator.
-->
<aggregates>
<!--
Defines an aggregate that handles nt:file and nt:resource nodes.
-->
<aggregate type="file" title="File Aggregate"/>

<!--
Defines an aggregate that handles file/folder like nodes. It matches
all nt:hierarchyNode nodes that have or define a jcr:content
child node and excludes child nodes that are nt:hierarchyNodes.
-->
<aggregate type="filefolder" title="File/Folder Aggregate"/>

<!--
Defines an aggregate that handles nt:nodeType nodes and serializes
them into .cnd notation.
-->
<aggregate type="nodetype" title="Node Type Aggregate" />

<!--
Defines an aggregate that defines full coverage for certain node
types that cannot be covered by the default aggregator.
-->
<aggregate type="full" title="Full Coverage Aggregate">
<matches>
<include nodeType="rep:AccessControl" respectSupertype="true" />
<include nodeType="rep:Policy" respectSupertype="true" />
<include nodeType="cq:Widget" respectSupertype="true" />
<include nodeType="cq:EditConfig" respectSupertype="true" />
<include nodeType="cq:WorkflowModel" respectSupertype="true" />
<include nodeType="vlt:FullCoverage" respectSupertype="true" />
<include nodeType="mix:language" respectSupertype="true" />
<include nodeType="sling:OsgiConfig" respectSupertype="true" />
</matches>
</aggregate>

<!--
Defines an aggregate that handles nt:folder like nodes.
-->
<aggregate type="generic" title="Folder Aggregate">
<matches>
<include nodeType="nt:folder" respectSupertype="true" />
</matches>
<contains>
<exclude isNode="true" />
</contains>
</aggregate>

<!--
Defines the default aggregate
-->
<aggregate type="generic" title="Default Aggregator" isDefault="true">
<matches>
<!-- all -->
</matches>
<contains>
<exclude nodeType="nt:hierarchyNode" respectSupertype="true" />
</contains>
</aggregate>

</aggregates>

<!--
defines the input handlers
-->
<handlers>
<handler type="folder"/>
<handler type="file"/>
<handler type="nodetype"/>
<handler type="generic"/>
</handlers>
</vaultfs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:description="${projectName} Pre-requisites Package"
jcr:primaryType="vlt:PackageDefinition"
sling:resourceType="cq/packaging/components/pack/definition"
buildCount="1"
cqVersion="${aemVersion}"
group="${packageGroup}"
name="${prereqArtifactId}"
path="/etc/packages/${packageGroup}/${prereqArtifactId}-${version}"
version="${version}">
<filter jcr:primaryType="nt:unstructured">
<f0
jcr:primaryType="nt:unstructured"
mode="replace"
root="/apps/${appsPrereqFolderName}"
rules="[]"/>
</filter>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/${appsPrereqFolderName}"/>
</workspaceFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<'cq'='http://www.day.com/jcr/cq/1.0'>
<'nt'='http://www.jcp.org/jcr/nt/1.0'>
<'jcr'='http://www.jcp.org/jcr/1.0'>
<'sling'='http://sling.apache.org/jcr/sling/1.0'>
<'rep'='internal'>

[cq:Page] > nt:hierarchyNode
orderable primaryitem jcr:content
+ * (nt:base) = nt:base version
+ jcr:content (nt:base) = nt:unstructured

[sling:Folder] > nt:folder
- * (undefined) multiple
- * (undefined)
+ * (nt:base) = sling:Folder version

[rep:RepoAccessControllable]
mixin
+ rep:repoPolicy (rep:Policy) protected ignore

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>FileVault Package Properties</comment>
<entry key="buildCount">1</entry>
<entry key="version">${version}</entry>
<entry key="dependencies" />
<entry key="packageFormatVersion">2</entry>
<entry key="description">${projectName} Pre-requisites Content Package</entry>
<entry key="group">${packageGroup}</entry>
<entry key="name">${prereqArtifactId}</entry>
<entry key="path">/etc/packages/${packageGroup}/${prereqArtifactId}-${version}.zip</entry>
</properties>
Loading