Add the plugin to your ui.apps / "content-package" type pom.xml
<plugin> <groupId>net.adamcin.oakpal</groupId> <artifactId>oakpal-maven-plugin</artifactId> <version>2.2.2</version> <configuration> </configuration> <executions> <execution> <goals> <goal>scan</goal> </goals> </execution> </executions> </plugin>
To properly prepare the scan for your code package, you might first need to export the Compact NodeType Definition (CND) from your Commercial Oak-based Product and make it available to the plugin.
In Adobe AEM development, it is as simple as visiting crx/de lite on a representative installation, such as a properly patched local quickstart environment.
Click Tools -> Export Node Type.
You will see the generated CND content rendered directly.
<'sling'='http://sling.apache.org/jcr/sling/1.0'> <'nt'='http://www.jcp.org/jcr/nt/1.0'> <'cq'='http://www.day.com/jcr/cq/1.0'> <'oak'='http://jackrabbit.apache.org/oak/ns/1.0'> <'jcr'='http://www.jcp.org/jcr/1.0'> <'mix'='http://www.jcp.org/jcr/mix/1.0'> <'granite'='http://www.adobe.com/jcr/granite/1.0'> <'rep'='internal'> <'xmp'='http://ns.adobe.com/xap/1.0/'> <'social'='http://www.adobe.com/social/1.0'> <'dam'='http://www.day.com/dam/1.0'> <'oauth'='http://oauth.net/'> <'rdf'='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <'vlt'='http://www.day.com/jcr/vault/1.0'> <'slingevent'='http://sling.apache.org/jcr/event/1.0'> <'fd'='http://www.adobe.com/aemfd/fd/1.0'> [sling:OrderedFolder] > sling:Folder orderable + * (nt:base) = sling:OrderedFolder version [cq:OwnerTaggable] > cq:Taggable mixin [oak:Unstructured] - * (undefined) multiple - * (undefined) + * (nt:base) = oak:Unstructured version ...
Save the output as a file under src/test/resources in your ui.apps module and add the <cndNames>/<cndName> parameter to your oakpal-maven-plugin configuration with the path to the file.
<plugin> <groupId>net.adamcin.oakpal</groupId> <artifactId>oakpal-maven-plugin</artifactId> <version>2.2.2</version> <configuration> <cndNames> <cndName>[your-cnd-filename]</cndName> </cndNames> </configuration> <executions> <execution> <goals> <goal>scan</goal> </goals> </execution> </executions> </plugin>
The basic checklist implements some sane default package acceptance rules, like disallowing subpackages, deletion of existing paths, unsafe acHandling modes, and preventing workspace filter overlaps between multiple packages.
To accept the defaults, just add the <checklists><checklist>basic</checklist></checklists> element to your config.
<plugin> <groupId>net.adamcin.oakpal</groupId> <artifactId>oakpal-maven-plugin</artifactId> <version>2.2.2</version> <configuration> <cndNames> <cndName>[your-cnd-filename]</cndName> </cndNames> <checklists> <checklist>basic</checklist> </checklists> </configuration> <executions> <execution> <goals> <goal>scan</goal> </goals> </execution> </executions> </plugin>
To override the default configuration of a basic check, just add a <checks>/<check> element to your plugin configuration. Specify the name of the basic check you wish to override, and provide a <config> element with custom values, or specify <skip>true</skip> to disable the check altogether.
<plugin> <groupId>net.adamcin.oakpal</groupId> <artifactId>oakpal-maven-plugin</artifactId> <version>2.2.2</version> <configuration> <cndNames> <cndName>[your-cnd-filename]</cndName> </cndNames> <checklists> <checklist>basic</checklist> </checklists> <checks> <check> <name>paths</name> <config> <rules> <rule> <type>deny</type> <pattern>/etc(/.*)?</pattern> </rule> </rules> </config> </check> <check> <name>subpackages</name> <skip>true</skip> </check> <!-- to use checks that are skipped by default, you need to reference their name in a template element --> <check> <name>myEcho</name> <template>echo</template> </check> </checks> </configuration> <executions> <execution> <goals> <goal>scan</goal> </goals> </execution> </executions> </plugin>
Check <config> elements are transformed to the JSON format expected by the ProgressCheckFactory by the JavaxJsonObjectConverter.
Follow these instructions to create a script check for your package build.