2 October 2013

Automate p2 Eclipse plugin transfer to Maven

In my last post i discribed a way to transfer Eclsipe p2 plugins to a Maven repository. To automate this in a Maven project one can setup a pom like this:

<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>your-group-id</groupId>
    <artifactId>your-artifact-id</artifactId>
    <version>1.0.0</version>
    <name>your-name</name>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

     <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>copy-eclipse-resources-to-maven</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>to-maven</goal>
                        </goals>
                        <configuration>
                            <eclipseDir>${basedir}/src/main/config/eclipse</eclipseDir>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.4.0</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>obr-indexing</id>
                        <phase>install</phase>
                        <configuration>
                            <urlTemplate>maven</urlTemplate>
                        </configuration>
                        <goals>
                            <goal>clean</goal>
                            <goal>index</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

After the transfer the maven bundle plugin will do an indexing so all plugins are also available in the Object Bundle Repository.

No comments:

Post a Comment