在Adobe CQ中安装MAVEN构建依赖项[OSGi包]



我们有一个CQ REST API项目与我们的消费者共享内容。这个包是用osgi jax-rs连接器创建的。我们还在孵化阶段,但看起来整合工作得很好。

我们面临的问题是"osgi jax-rs连接器"项目需要在CQ中安装一些包(由项目提供的osgified)。目前我们正在使用felix控制台手动执行此操作。

我们可以使用MAVEN自动化这个过程吗(我们可以安装我们使用MAVEN创建的包)

任何指向这个的指针都是有帮助的。

如果你也有一个UI包,例如与maven-vault-plugin一起安装的ZIP,你可以将JAR文件放在任何文件夹中。我通常称之为install:

/apps/myproject/install

CQ中有一个处理程序可以识别内容包中的JAR文件并将它们安装到OSGi中。

如果您正在构建一个zip包来安装,您可以使用maven安装包,而不包括项目中的依赖项,从而为您的SCM增加额外的空间。

你可以使用maven-assembly-plugin插件。

例如,在您的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>

然后在zip。xml中创建一个像这样的程序集文件

<?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>

您可以根据需要调整依赖集和文件集设置。显然,我编造了一个AEM应用程序名称和maven工件。

最新更新