kallada
kallada

Reputation: 1929

Installing MAVEN build dependencies [OSGi bundles] with Maven in to Adobe CQ

We have an CQ REST API project to share content with our consumers. The bundle is created with osgi jax-rs connector. We are still in incubation state, but it seems the integration is working fine.

The issue we are facing is the "osgi jax-rs connector" project requires some bundles (osgified ones, provided by the project) to be installed in CQ. Currently we are doing this manually, using the felix console.

Can we automate the process using MAVEN (we can install the bundle which we created using MAVEN).

Any pointers to this would be helpful.

San

Upvotes: 0

Views: 437

Answers (2)

winkle
winkle

Reputation: 149

If you are building a zip package to install you can have the bundles installed with maven and not include the dependencies in your project adding additional space to your SCM.

To do this you can use the maven-assembly-plugin plugin.

For example include this in your pom.xml:

    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptors>
                    <descriptor>src/main/assembly/zip.xml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

And then in you zip.xml you would create an assembly file like this:

<?xml version='1.0' encoding='UTF-8'?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>zip</id>
    <formats>
    <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
    <fileSet>
        <directory>${basedir}/src/main/content/jcr_root</directory>
        <outputDirectory>jcr_root</outputDirectory>
        <excludes>
            <exclude>**/.DS_Store</exclude>
        </excludes>
        <filtered>false</filtered>
    </fileSet>
    </fileSets>
    <dependencySets>
    <dependencySet>
        <outputDirectory>jcr_root/apps/myapp/install</outputDirectory>
        <useProjectArtifact>false</useProjectArtifact>
        <scope>compile</scope>
        <includes>
            <include>com.my.groupid:my-maven-artifact-id</include>
        </includes>
        <useStrictFiltering>true</useStrictFiltering>
    </dependencySet>
    </dependencySets>
</assembly>

You can adjust the dependency set and file set settings as needed. Obviously I made up an AEM app name and maven artifact.

Upvotes: 1

Thomas
Thomas

Reputation: 7078

If you also have a UI package, e.g. a ZIP that gets installed with the maven-vault-plugin you can place JAR files in any folder. I usually call it install:

/apps/myproject/install

There is a handler in CQ that recognizes JAR files in a content package and installs them to OSGi.

Upvotes: 2

Related Questions