【问题标题】:Installing MAVEN build dependencies [OSGi bundles] with Maven in to Adobe CQ使用 Maven 将 MAVEN 构建依赖项 [OSGi 捆绑包] 安装到 Adob​​e CQ
【发布时间】:2015-09-22 23:43:34
【问题描述】:

我们有一个 CQ REST API 项目来与我们的消费者共享内容。该捆绑包是使用 osgi jax-rs 连接器创建的。我们仍处于孵化状态,但似乎集成工作正常。

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

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

对此的任何指示都会有所帮助。

【问题讨论】:

    标签: maven jax-rs aem


    【解决方案1】:

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

    /apps/myproject/install
    

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

    【讨论】:

      【解决方案2】:

      如果您正在构建要安装的 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 工件。

      【讨论】:

        猜你喜欢
        • 2014-06-01
        • 2012-04-20
        • 2014-03-12
        • 2015-10-04
        • 1970-01-01
        • 2012-03-06
        • 1970-01-01
        • 2013-02-28
        • 1970-01-01
        相关资源
        最近更新 更多