【问题标题】:How to package plugin and feature into OSGI bundle using p2-maven-plugin如何使用 p2-maven-plugin 将插件和功能打包到 OSGI 包中
【发布时间】:2015-06-01 13:23:24
【问题描述】:

我创建了一个插件和功能项目(用于插件)。我正在使用 tycho (maven) 来构建它。我能够成功构建它。现在我想打包成 osgi 包(plugin.jar、feature.jar、artifacts.jar、content.jar)。为此,我正在使用 p2-maven-plugin 但我不知道如何将 plugin.jar 和 feature.jar 指定到 osgi 项目(创建 osgi 包)的 pom.xml 中。

下面是我创建 osgi 包的 pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.exililty.tycho</groupId>
  <artifactId>com.exility.plugin.osgi</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
<build>
    <plugins>
      <plugin>
        <groupId>org.reficio</groupId>
        <artifactId>p2-maven-plugin</artifactId>
        <version>1.1.2-SNAPSHOT</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <configuration>
              <artifacts>
                <!-- specify your depencies here -->
                <!-- groupId:artifactId:version -->
                <artifact>
                  <id> </id>
                </artifact>
                 <artifact>
                  <id> </id>
                </artifact>
                
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <pluginRepositories>
    <pluginRepository>
      <id>reficio</id>
      <url>http://repo.reficio.org/maven/</url>
    </pluginRepository>
  </pluginRepositories>

</project>

我可以插入插件和功能 jar 作为工件吗?如何在 pom.xml 中指定插件 jar。请帮忙!

【问题讨论】:

    标签: java maven eclipse-plugin m2eclipse


    【解决方案1】:

    p2-maven-plugin 用于创建具有分类插件/功能的 P2 Target 存储库,而不是 OSGi 包。我希望这能说明这个 maven 插件的目的是什么。如果您的任务是创建 P2 目标存储库,那么您可以定义添加一个功能,如 p2-maven-plugin 示例中所述:

    <configuration>
        <artifacts>
            <artifact><id>org.apache.commons:commons-lang3:3.1</id></artifact>
        </artifacts>
        <features>
            <artifact>
                <id>org.reficio:test.feature:1.0.0</id>
                <source>false</source>
                <transitive>false</transitive>
            </artifact>
        </features>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 2010-11-25
      • 1970-01-01
      • 2016-09-21
      • 1970-01-01
      • 2012-10-23
      • 2016-02-20
      • 2014-03-12
      • 2010-12-08
      • 2019-05-22
      相关资源
      最近更新 更多