Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

iPOJO Ant Task allows automating the iPOJO manipulation process within an Ant build process. This page explains how to use the iPOJO Ant Task and how to combine them with the BND Tasks.

Div
classtoc
Table of Contents
maxLevel4
minLevel2
Wiki Markup
{div:class=toc} {toc:maxLevel=4|minLevel=2} {div}

Downloading the iPOJO Ant Task

...

The iPOJO Ant task take an input bundle and a metadata file and create the final (i.e. manipulated) bundle.
To use the task declare a target in your build.xml as:

Div
classpom

<target

Wiki Markup
{div:class=pom} <target

name="main">

&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


    <!--

Change

the

path

to

point

on

the

iPOJO

Ant

task

jar-->

{color} &nbsp;&nbsp;&nbsp;&nbsp;<taskdef


    <taskdef name="ipojo"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classname


        classname="org.apache.felix.ipojo.task.IPojoTask"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


        classpath="org.apache.felix.ipojo.ant-1.6.0.jar"

{color}/> &nbsp;&nbsp;&nbsp;&nbsp;<ipojo &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input

/>

    <ipojo
        input="foo.jar"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;metadata =


        metadata = "meta.xml"

&nbsp;&nbsp;&nbsp;&nbsp;


    />


</target>

{div}

First, define the new task. Then simply use it. The input argument describe the input bundle (must exists) and the metadata argument describes the metadata file (must exist too). The input bundle must be a well-formed bundle.

...

The iPOJO Ant Task requires an input bundle. BND is a tools simplifying bundle creation. So, it is possible to combine the two tools to create your bundle automatically. The following build.xml shows you an example of combination.

Div
classpom

<project

Wiki Markup
{div:class=pom} <project

default="main"

basedir=".">

&nbsp;&nbsp;&nbsp;&nbsp;<target


    <target name="bnd">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


      <!--

Change

to

use

the

latest

BND

version --{color}{color:red}>{color} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<taskdef

version –>
      <taskdef resource="aQute/bnd/ant/taskdef.properties"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


        classpath="bnd-0.0.178.jar"

{color}/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<bnd &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classpath="src" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eclipse="true" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;failok="false" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exceptions="true" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}

/>
      <bnd
        classpath="src"
        eclipse="true"
        failok="false"
        exceptions="true"
        files="foo.bnd"

{color}/> &nbsp;&nbsp;&nbsp;&nbsp;</target> &nbsp;&nbsp;&nbsp;&nbsp;<target

/>
    </target>

    <target name="main"

depends="bnd">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <echo


       <echo message="Call

main"/>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


      <!--

Change

the

path

to

point

on

the

iPOJO

Ant

task

jar

-->

{color} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<taskdef


      <taskdef name="ipojo"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classname


        classname="org.apache.felix.ipojo.task.IPojoTask"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


        classpath="org.apache.felix.ipojo.ant-1.6.0.jar"

{color} /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ipojo &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}

/>
      <ipojo
        input="foo.jar"

{color} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;metadata =


        metadata = "meta.xml"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /> &nbsp;&nbsp;&nbsp;&nbsp;</target> </project> {div}


       />
    </target>
</project>

The first target creates the bundle with BND. More details on the BND Ant Task are available here. To combine the BND output and the iPOJO input, the iPOJO input need to be the same as the BND file but with the ".jar" extension. For instance, the BND file is foo.bnd, so the input jar must be foo.jar.
To be sure that the BND bundle is already created, you can add the "depends" clause in the target using the iPOJO task to the target creating the bundle.

However, it is possible to create only one target doing the two operations as:

Div
classpom

<target

Wiki Markup
{div:class=pom} <target

name="main">

&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


    <!--

Change

to

use

the

latest

BND

version

-->

{color} &nbsp;&nbsp;&nbsp;&nbsp;<taskdef &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resource


    <taskdef
      resource="aQute/bnd/ant/taskdef.properties"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


      classpath="bnd-0.0.178.jar"/>

{color} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}

      <!--

Change

the

path

to

point

on

the

iPOJO

Ant

task

jar

-->

{color} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<taskdef


      <taskdef name="ipojo"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classname


        classname="org.apache.felix.ipojo.task.IPojoTask"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color:red}


        classpath="org.apache.felix.ipojo.ant-1.6.0.jar"

{color}/> &nbsp;&nbsp;&nbsp;&nbsp;<bnd &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classpath="src" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eclipse="true" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;failok="false" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exceptions="true" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files="{color:red}foo.bnd{color}"/> &nbsp;&nbsp;&nbsp;&nbsp;<ipojo &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input="{color:red}foo.jar{color}" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;metadata =

/>

    <bnd
        classpath="src"
        eclipse="true"
        failok="false"
        exceptions="true"
        files="foo.bnd"/>

    <ipojo
      input="foo.jar"
      metadata = "meta.xml"/>


</target>

{div}

Directory manipulation

The manipulator can take a directory in input. In this case, classes from this folder is manipulated. You can also set the manifest file location too. Here in an example of configuration using this mode:

...