2
votes

I have created one plugin and feature project(for the plugin).I am using tycho (maven) to build it. i am able to build it successfully.Now I want to package into osgi bundle (plugin.jar, feature.jar,artifacts.jar,content.jar).For that, I am using p2-maven-plugin but I dont know how to specify plugin.jar and feature.jar into pom.xml of osgi project(that creates osgi bundle).

Below is my pom.xml that creates osgi bundle:

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

Can I insert plugin and feature jar as artifact? How to specify plugins jar into pom.xml. Please help !

1

1 Answers

1
votes

The p2-maven-plugin is used to create a P2 Target repository with categorized plugins/features and not an OSGi bundle. I hope this makes clear what the purpose of this maven plugin is. If your task is to create a P2 Target repository then you can definetely add a feature as described in the p2-maven-plugin example:

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