This project is designed for Hippo developers to have an easy way to create updaters in groovy, without being bothered with the repository data yaml.
For use the updaters are located in their own submodule. Nicely separated from other bootstrap. They are groovy scripts, so the editor can easily provide autocomplete and stuff, configured by Annotations.
The groovy scripts are by default located in:
/src/main/scripts
- Groovy updater annotations
- Groovy updater bootstrap generator
- Groovy updater maven plugin
- Sample project for the maven plugin
- Synchronisation module for updater scripts
Minimal use for the Updater definition
@Updater(name = "Name", xpath = "//element(*, hst:mount)")
Bootstrap definition is optional
@Bootstrap(reload = true)
To exclude a groovy script from being bootstrapped:
@Exclude
To add mixin(s) (since 1.14):
@Updater(name = "Name", mixin = "hippo:named, mix:referenceable")
In the build section of the (new) module containing the groovy updater scripts, define the execution of the plugin
<plugin>
<groupId>nl.openweb.hippo.updater</groupId>
<artifactId>groovy-updater-maven-plugin</artifactId>
<version>${groovy-updater-maven-plugin.version}</version>
<executions>
<execution>
<id>default-resources</id>
<phase>compile</phase>
<goals>
<goal>generate-yaml</goal>
</goals>
</execution>
</executions>
</plugin>
- sourceDir
- the source of the groovy files
default: ${project.build.scriptSourceDirectory}
- the source of the groovy files
- targetDir
- where to generate the bootstrap
(default: ${project.build.outputDirectory})
- where to generate the bootstrap
- defaultContentRoot
- default contentroot value (registry/queue)
(default: queue)
- default contentroot value (registry/queue)
- yamlContentPath (since 1.13)
- relative path for the yaml queue bootstrap files
(default: hcm-content/configuration/update)
- relative path for the yaml queue bootstrap files
- yamlConfigurationPath (since 1.13)
- relative path for the yaml registry bootstrap files
(default: hcm-config/configuration/update)
- relative path for the yaml registry bootstrap files
When using a separate module, don't forget to place an hcm-module.yaml in the project.
group:
name: hippoproject
project: hippoproject
module:
name: hippoproject-repository-data-updaters
after: hippoproject-repository-data-content
<dependency>
<groupId>nl.openweb.hippo.updater</groupId>
<artifactId>groovy-updater-annotations</artifactId>
<version>${groovy-updater-maven-plugin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>${hippo.jackrabbit.version}</version>
<scope>provided</scope>
</dependency>
This module has copied some logic and classes from the well known webfiles module.
The updater scripts add changed groovy scripts to the updaters registry.
the module is registered at:
/hippo:configuration/hippo:modules/groovyfiles
Add this dependency to the cms or a dependency of the cms, like a separate 'updaters' module or 'content', use this for local development only.
It is highly recommended to use a profile for it.
<dependency>
<groupId>nl.openweb.hippo.updater</groupId>
<artifactId>groovy-updater-sync</artifactId>
<version>${groovy-updater-maven-plugin.version}</version>
</dependency>
By default the updater-sync plugin watches a module named 'updater', to use a different module as source for the scripts,
set the system property groovy.sync.watchedModules
in the cargo container.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
...
<container>
...
<systemProperties>
...
<groovy.sync.watchedModules>updater</groovy.sync.watchedModules>
</systemProperties>
</container>
</configuration>
</plugin>
Add an info logging level for nl.openweb.hippo.groovy to your development log4j configuration
<Logger name="nl.openweb.hippo.groovy" additivity="false" level="info">
<AppenderRef ref="messages"/>
</Logger>