Using the CoreMedia Webresources Maven Plugin

This section describes how to use the CoreMedia Webresources Maven Plugin to transform your web resources to serverimportable content.

Provide the Theme Artifacts

The CoreMedia Webresources Maven Plugin processes a certain kind of dependency:

  • It must be of type "zip".
  • It must be classified as "theme".
  • The actual artifact must be a zip file.
    • The zip file contains the plain web resources, i.e. CSS files, JavaScript files and collateral files like images and fonts.
    • The directory structure of the zip file is arbitrary, however it is recommended to use a single root directory for each theme.
    • There is one special top level directory THEME-METADATA. This name is reserved in the context of a theme artifact. The directory is optional and contains theme definition files which constitute the themes from the single web resources. For details about theme definitions see the Blueprint documentation.

The Blueprint's theme modules provide such artifacts by default.

Depend on the Theme Artifacts

The module which uses this plugin must depend on the themes to be processed. The type and the classifier are important for the plugin to recognize the dependency as a theme to be processed.

    <dependency>
        <groupId>myproject.example.com</groupId>
        <artifactId>my-theme</artifactId>
        <version>1.2.3</version>
        <classifier>theme</classifier>
        <type>zip</type>
        <scope>runtime</scope>
    </dependency>

If the theme depends on other themes, you need an additional pom dependency in order to make your module and this plugin aware of the transitivity:

    <dependency>
        <groupId>myproject.example.com</groupId>
        <artifactId>my-theme</artifactId>
        <version>1.2.3</version>
        <type>pom</type>
        <scope>runtime</scope>
    </dependency>

Activate the CoreMedia Webresources Maven Plugin

Add the following snippet to the build/plugins section of your pom:

        <!-- Create Webresource content in target folder -->
        <plugin>
            <groupId>com.coremedia.maven</groupId>
            <artifactId>coremedia-webresource-content-maven-plugin</artifactId>
            <!-- Provide doctypes to create web resources as content-->
            <dependencies>
                <dependency>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>contentserver-blueprint-component</artifactId>
                    <version>${project.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.coremedia.cms</groupId>
                    <artifactId>cap-importer</artifactId>
                    <version>${cms.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.coremedia.cms</groupId>
                    <artifactId>cap-unified-api</artifactId>
                    <version>${cms.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.coremedia.cms</groupId>
                    <artifactId>serverimportexport</artifactId>
                    <version>${cms.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.coremedia.cms</groupId>
                    <artifactId>cap-client-embedded</artifactId>
                    <version>${cms.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.coremedia.cms</groupId>
                    <artifactId>coremedia-xml</artifactId>
                    <version>${cms.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>compile-resource-corporate-testdata</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <phase>compile</phase>
                </execution>
            </executions>
        </plugin>

The document type dependency is needed only for technical reasons (the plugin uses a temporary content server internally). It is not for flexibility. The plugin needs the Blueprint document types, esp. CMAbstractCode and its subtypes. Furthermore the plugin needs some components from the cms-core. Your core-version must be injected here.