如何使用第三方罐子进入AEM



我有一个从其他团队收到的JAR文件,需要在AEM中使用。我不能直接在AEM中使用Jar,因此我在链接" https://helpx.adobe.com/experience-manager/kb/convertajarintoosgibundle.html"的帮助下将罐子转换为捆绑包。通过Felix控制台AEM。捆绑包活跃。现在,我需要使用我的Java课程中的Classe。如何在Java类中使用该bunlde。我需要在pom.xml中添加捆绑包吗?如果这样

现在,我的捆绑包已经准备就绪,并通过Felix Console上传到AEM

那不是一个好主意。是的,您可以从Felix控制台安装捆绑包,但是AEM中的捆绑包装应由Sling Osgi安装程序管理,该安装程序可以扫描JCR存储库中的捆绑库。

如其他响应中所述,您应该将捆绑包放入/apps文件夹下方的名为"安装"的文件夹中。

我的建议是使用用于生成AEM注释的Maven Content Packin插件将您的捆绑包嵌入您的AEM软件包:

    <build>
    <plugins>
        <plugin>
            <groupId>com.day.jcr.vault</groupId>
            <artifactId>content-package-maven-plugin</artifactId>
            <configuration>
                <failOnMissingEmbed>true</failOnMissingEmbed>
                <filterSource>src/main/META-INF/vault/filter.xml</filterSource>
                <filters combine.self="override" />
                <embeddeds>
                    <embedded>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.models.validation-impl</artifactId>
                        <target>/apps/example/install</target>
                    </embedded>
                </embeddeds>
            </configuration>
        </plugin>
    </plugins>
</build>

另外,不要忘记将/apps/example/install添加到您的filter.xml。

有关内容软件包插件的更多信息

您可以将LIB放入src/main/jcr_root/apps/your_app/libs/install文件夹中(路径取决于您的项目结构(。现在它将使用Maven安装到AEM。

要导入必要的类使用范围,我们对jedis lib有以下配置:

<dependency>
    <groupId>org.apache.servicemix.bundles</groupId>
    <artifactId>org.apache.servicemix.bundles.jedis</artifactId>
    <version>2.7.3_1</version>
    <scope>provided</scope>
</dependency>

最新更新