Apache

How to use the iPOJO Maven Plug-in

To use the iPOJO Maven plug-in, edit the following pom.xml (replace all $xxx elements):

<project>
 <modelVersion>4.0.0</modelVersion>
 <packaging>bundle</packaging> <!-- Use the BND Maven plug-in -->
  <groupId>$YOUR_GROUP_ID</groupId>
 <artifactId>$YOUR_ARTIFACT_ID</artifactId>
  <version>$YOUR_ARTIFACT_VERSION</version>
  <name>$YOUR_PROJECT_NAME</name>

  <dependencies>
    $YOUR_MAVEN_DEPENDECIES
  </dependencies>

  <!-- To download automatically the iPOJO Maven Plugin -->
 <pluginRepositories>
   <pluginRepository>
     <id>apache.snapshots</id>
      <name>snapshot plugins</name>
     <url>
       http://people.apache.org/repo/m2-snapshot-repository
     </url>
     <releases>
       <enabled>false</enabled>
     </releases>
     <snapshots>
       <enabled>true</enabled>
     </snapshots>
   </pluginRepository>
 </pluginRepositories>

 <build>
   <plugins>
     <!-- BND Maven Plugin Configuration -->
     <plugin>
       <groupId>org.apache.felix</groupId>
       <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
           <Private-Package>$YOUR_PRIVATE_PACKAGE</Private-Package>
           <Export-Package>$YOUR_EXPORTED_PACKAGE</Export-Package>
         </instructions>
       </configuration>
     </plugin>
     <!-- iPOJO Maven Plugin Configuration : nothing to do -->
     <plugin>
             <groupId>org.apache.felix</groupId>
             <artifactId>maven-ipojo-plugin</artifactId>
             <version>0.8.0-SNAPSHOT</version>
        <executions>
          <execution>
              <goals>
                     <goal>ipojo-bundle</goal>
              </goals>
         </execution>
       </executions>
     </plugin>
   </plugins>
 </build>
</project>

The iPOJO Maven Plug-in is generally used with the BND Maven Plug-in (more details here). However the two configurations are completely separated. So, you can use all BND Maven plug-in features. The iPOJO configuration section can be used as previously written without any changes. However it requires that your metadata file is inside the "src/main/resources" folder and is named "metadata.xml".

Execution

To manipulate your project, use the "mvn clean install" command. The output should be like:

[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Hello Client
[INFO]   task-segment: [clean, install]
[INFO] ----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory D:\clement\workspaces\iPOJO-Dev\hello.client\target
[INFO] Deleting directory D:\clement\workspaces\iPOJO-Dev\hello.client\target\classes
[INFO] Deleting directory D:\clement\workspaces\iPOJO-Dev\hello.client\target\test-classes
[INFO] Deleting directory D:\clement\workspaces\iPOJO-Dev\hello.client\target\site
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to D:\clement\workspaces\iPOJO-Dev\hello.client\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] Resource directory does not exist: D:\clement\workspaces\iPOJO-Dev\hello.client\src\test\resources
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [bundle:bundle]
[INFO] [org.apache.felix.ipojo.:ipojo-bundle {execution: default}]
[INFO] Start bundle manipulation
[INFO] Metadata File : D:\clement\workspaces\iPOJO-Dev\hello.client\target\classes\metadata.xml
[INFO] Input Bundle File : D:\clement\workspaces\iPOJO-Dev\hello.client\target\hello.client-0.0.1.jar
[INFO] Bundle manipulation - SUCCESS
[INFO] [install:install]
[INFO] Installing D:\clement\workspaces\iPOJO-Dev\hello.client\target\hello.client-0.0.1.jar to D:\Dev\maven-repo\ipojo\example\hello.client\0.0.1\hello.client-0.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Mon Aug 13 14:04:55 CEST 2007
[INFO] Final Memory: 6M/13M
[INFO] ------------------------------------------------------------------------

Configuration Options

You can configure the localization of the iPOJO metadata file as following:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-ipojo-plugin</artifactId>
    <version>0.8.0-SNAPSHOT</version>
    <executions>
        <execution>
        <goals>
            <goal>ipojo-bundle</goal>
        </goals>
        <configuration>
             <metadata>ipojo/meta.xml</metadata>
        </configuration>
        </execution>
   </executions>
</plugin>

In the metadata element, you can specify your metadata files. This file must be either in the same directory than the POM file (project root) or in one of the resource folder of the maven project (for instance, "src/main/resources/ipojo/meta.xml").

The second option allows skipping annotations processing, by using the "ignoreAnnotations" element:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-ipojo-plugin</artifactId>
    <version>0.8.0-SNAPSHOT</version>
    <executions>
        <execution>
        <goals>
            <goal>ipojo-bundle</goal>
        </goals>
        <configuration>
            <ignoreAnnotations>true</ignoreAnnotations>
        </configuration>
        </execution>
   </executions>
</plugin>


Overview
Getting Started
User Guide
Tools
Developer Guide
Misc & Contact