blob: 0798f4adc786b1a1146f168e722dc6d304fae9ff [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head>
<title>Apache Felix - iPOJO Ant Task</title>
<link rel="stylesheet" href="ipojo-ant-task_files/site.css" type="text/css" media="all">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head><body>
<div class="title"><div class="logo"><a href="http://felix.apache.org/site/index.html"><img alt="Apache Felix" src="ipojo-ant-task_files/logo.png" border="0"></a></div><div class="header"><a href="http://www.apache.org/"><img alt="Apache" src="ipojo-ant-task_files/apache.png" border="0"></a></div></div>
<div class="menu">
<ul>
<li><a href="http://felix.apache.org/site/news.html" title="news">news</a></li>
<li><a href="http://felix.apache.org/site/license.html" title="license">license</a></li>
<li><span class="nobr"><a href="http://felix.apache.org/site/downloads.cgi" title="Visit page outside Confluence" rel="nofollow">downloads<sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span></li>
<li><a href="http://felix.apache.org/site/documentation.html" title="documentation">documentation</a></li>
<li><a href="http://felix.apache.org/site/mailinglists.html" title="mailinglists">mailing lists</a></li>
<li><a href="http://felix.apache.org/site/contributing.html" title="Contributing">contributing</a></li>
<li><span class="nobr"><a href="http://www.apache.org/" title="Visit page outside Confluence" rel="nofollow">asf<sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span></li>
<li><span class="nobr"><a href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">sponsorship<sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span></li>
<li><span class="nobr"><a href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">sponsors<sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span>
<!-- ApacheCon Ad -->
<iframe src="ipojo-ant-task_files/button.html" style="border-width: 0pt; float: left;" scrolling="no" width="135" frameborder="0" height="135"></iframe>
<p style="height: 100px;">
<!-- ApacheCon Ad -->
</p></li></ul> </div>
<div class="main">
<table class="sectionMacro" border="0" cellpadding="5" cellspacing="0" width="100%"><tbody><tr>
<td class="confluenceTd" valign="top" width="80%">
<h1><a name="iPOJOAntTask-iPOJOAntTask"></a>iPOJO Ant Task</h1>
<p>iPOJO Ant Task allows automating the iPOJO manipulation process.
This page explains how to use the iPOJO Ant Task and how to combine
them with the BND Tasks.</p>
<h2><a name="iPOJOAntTask-DownloadingtheiPOJOAntTask"></a>Downloading the iPOJO Ant Task</h2>
<p>The iPOJO Ant Task can ben downloaded from <a href="http://felix.apache.org/site/download.html" title="Download">here</a>.</p>
<h2><a name="iPOJOAntTask-HowtousetheAntTask"></a>How to use the Ant Task</h2>
<p>The iPOJO Ant task take an input bundle and a metadata file and create the final (i.e. manipulated) bundle.<br>
To use the task declare a target in your build.xml as:</p>
<div class="panel"><div class="panelContent">
<p>&lt;target name="main"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">&lt;!-- Change the path to point on the iPOJO Ant task jar--&gt;</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;taskdef name="ipojo"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classname="org.apache.felix.ipojo.task.IPojoTask"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">classpath="org.apache.felix.ipojo.ant-1.0.0.jar"</font>/&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ipojo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input="foo.jar"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;metadata = "meta.xml"<br>
&nbsp;&nbsp;&nbsp;&nbsp;/&gt;<br>
&lt;/target&gt;</p>
</div></div>
<p>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.</p>
<h2><a name="iPOJOAntTask-AntTaskArguments"></a>Ant Task Arguments</h2>
<p>The iPOJO Ant Task as three different arguments:</p>
<ul>
<li>Input: describes the input bundle. This argument is mandatory.</li>
<li>Output: describes the output bundle. This argument is optional. If not present, the output file will be input file.</li>
<li>Metadata:
describes the metadata file. This argument is optional. By default, it
tries with a metadata.xml file (in the same directory as the build.xml
file). If the default file is not present, it tries to use only iPOJO
annotations.</li>
<li>IgnoreAnnotations: if set to <tt>true</tt>, the manipulator skips annotations processing.</li>
<li>IgnoreEmbeddedSchemas: if set to <tt>true</tt>, the manipulator doesn't use embedded XML-Schemas [1.1.0-SNAPSHOT]</li>
</ul>
<h2><a name="iPOJOAntTask-CombiningtheiPOJOAntTaskandBND"></a>Combining the iPOJO Ant Task and BND</h2>
<p>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.</p>
<div class="panel"><div class="panelContent">
<p>&lt;project default="main" basedir="."&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;target name="bnd"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">&lt;!-- Change to use the latest BND version –</font><font color="red">&gt;</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;taskdef resource="aQute/bnd/ant/taskdef.properties"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">classpath="bnd-0.0.178.jar"</font>/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bnd<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classpath="src"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eclipse="true"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;failok="false"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exceptions="true"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">files="foo.bnd"</font>/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/target&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;target name="main" depends="bnd"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;echo message="Call main"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">&lt;!-- Change the path to point on the iPOJO Ant task jar --&gt;</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;taskdef name="ipojo"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classname="org.apache.felix.ipojo.task.PojoTask"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">classpath="org.apache.felix.ipojo.ant-1.0.0.jar"</font> /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ipojo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">input="foo.jar"</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;metadata = "meta.xml"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/target&gt;<br>
&lt;/project&gt;</p>
</div></div>
<p>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.<br>
To be sure that the BND bundle is already created, you can add the "<em>depends</em>" clause in the target using the iPOJO task to the target creating the bundle.</p>
<p>However, it is possible to create only one target doing the two operations as:</p>
<div class="panel"><div class="panelContent">
<p>&lt;target name="main"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">&lt;!-- Change to use the latest BND version --&gt;</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;taskdef<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resource="aQute/bnd/ant/taskdef.properties"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">classpath="bnd-0.0.178.jar"/&gt;</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">&lt;!-- Change the path to point on the iPOJO Ant task jar --&gt;</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;taskdef name="ipojo"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classname="org.apache.felix.ipojo.task.IPojoTask"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">classpath="org.apache.felix.ipojo.ant-1.0.0.jar"</font>/&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;bnd<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classpath="src"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eclipse="true"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;failok="false"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exceptions="true"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files="<font color="red">foo.bnd</font>"/&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ipojo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input="<font color="red">foo.jar</font>"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;metadata = "meta.xml"/&gt;<br>
&lt;/target&gt;</p>
</div></div>
<h2><a name="iPOJOAntTask-Conclusion"></a>Conclusion</h2>
<p>Subscribe to the Felix users mailing list by sending a message to <span class="nobr"><a href="mailto:users-subscribe@felix.apache.org" title="Send mail to users-subscribe@felix.apache.org" rel="nofollow">users-subscribe@felix.apache.org<sup><img class="rendericon" src="ipojo-ant-task_files/mail_small.gif" alt="" align="absmiddle" border="0" width="13" height="12"></sup></a></span>; after subscribing, email questions or feedback to <span class="nobr"><a href="mailto:users@felix.apache.org" title="Send mail to users@felix.apache.org" rel="nofollow">users@felix.apache.org<sup><img class="rendericon" src="ipojo-ant-task_files/mail_small.gif" alt="" align="absmiddle" border="0" width="13" height="12"></sup></a></span></p></td>
<td class="confluenceTd" valign="top" width="20%">
<h6><a name="iPOJOAntTask-Overview"></a><b>Overview</b></h6>
<ul>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo.html" title="Apache Felix iPOJO">Home Page</a></li>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo-feature-overview.html" title="Apache Felix iPOJO Feature Overview">iPOJO Feature Overview</a></li>
<li><a href="http://felix.apache.org/site/download.html" title="Download">Download &amp; Install </a></li>
</ul>
<h6><a name="iPOJOAntTask-GettingStarted"></a><b>Getting Started</b></h6>
<ul>
<li><a href="http://felix.apache.org/site/ipojo-in-10-minutes.html" title="iPOJO in 10 minutes">iPOJO in 10 minutes</a></li>
<li><a href="http://felix.apache.org/site/how-to-use-ipojo-annotations.html" title="How to use iPOJO Annotations">How to use iPOJO Annotations</a></li>
<li><a href="http://felix.apache.org/site/ipojo-hello-word-maven-based-tutorial.html" title="iPOJO Hello Word (Maven-Based) tutorial">iPOJO Hello Word (Maven-Based) tutorial</a></li>
<li><a href="http://felix.apache.org/site/ipojo-advanced-tutorial.html" title="iPOJO Advanced Tutorial">iPOJO Advanced Tutorial</a></li>
<li><a href="http://felix.apache.org/site/ipojo-composition-tutorial.html" title="iPOJO Composition Tutorial">iPOJO Composition Tutorial</a></li>
</ul>
<h6><a name="iPOJOAntTask-UserGuide"></a><b>User Guide</b></h6>
<ul>
<li><a href="http://felix.apache.org/site/describing-components.html" title="Describing components">Describing components (handler list) </a></li>
<li><a href="http://felix.apache.org/site/using-xml-schemas.html" title="Using XML Schemas">Using XML Schemas</a></li>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo-testing-components.html" title="apache-felix-ipojo-testing-components">Testing components</a></li>
<li><a href="http://felix.apache.org/site/ipojo-advanced-topics.html" title="iPOJO Advanced Topics">Advanced Topics</a></li>
<li><a href="http://felix.apache.org/site/ipojo-faq.html" title="iPOJO FAQ">FAQ</a></li>
</ul>
<h6><a name="iPOJOAntTask-Tools"></a><b>Tools</b></h6>
<ul>
<li><a href="http://felix.apache.org/site/ipojo-eclipse-plug-in.html" title="iPOJO Eclipse Plug-in">iPOJO Eclipse Plug-in</a></li>
<li><a href="" title="iPOJO Ant Task">iPOJO Ant Task</a></li>
<li><a href="http://felix.apache.org/site/ipojo-maven-plug-in.html" title="iPOJO Maven Plug-in">iPOJO Maven Plug-in</a></li>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo-junit4osgi.html" title="apache-felix-ipojo-junit4osgi">Junit4OSGi</a></li>
<li><a href="http://felix.apache.org/site/ipojo-concepts-overview.html" title="iPOJO Concepts Overview">iPOJO concepts overview</a></li>
</ul>
<h6><a name="iPOJOAntTask-DeveloperGuide"></a><b>Developer Guide</b></h6>
<ul>
<li>API: <span class="nobr"><a href="http://people.apache.org/%7Eclement/ipojo/api/1.0/" title="Visit page outside Confluence" rel="nofollow">1.0<sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span></li>
<li><a href="http://felix.apache.org/site/how-to-write-your-own-handler.html" title="How to write your own handler">How to write your own handler</a></li>
<li><a href="http://felix.apache.org/site/how-to-use-ipojo-manipulation-metadata.html" title="How to use iPOJO Manipulation Metadata">How to use iPOJO Manipulation Metadata</a></li>
<li><a href="http://felix.apache.org/site/dive-into-the-ipojo-manipulation-depths.html" title="Dive into the iPOJO Manipulation depths">Dive into the iPOJO Manipulation depths</a></li>
</ul>
<h6><a name="iPOJOAntTask-Misc&amp;Contact"></a><b>Misc &amp; Contact</b></h6>
<ul>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo-issuestracker.html" title="apache-felix-ipojo-issuestracker">Issues Tracker</a></li>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo-supportedvms.html" title="apache-felix-ipojo-supportedVMs">Supported JVMs</a></li>
<li><a href="http://felix.apache.org/site/apache-felix-ipojo-supportedosgi.html" title="apache-felix-ipojo-supportedOSGi">Supported OSGi Implementations</a></li>
<li><span class="nobr"><a href="http://ipojo-dark-side.blogspot.com/" title="Visit page outside Confluence" rel="nofollow">iPOJO's Dark Side Blog<sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span></li>
<li><a href="http://felix.apache.org/site/future-ideas.html" title="Future Ideas">Future Ideas</a></li>
<li><a href="http://felix.apache.org/site/contact.html" title="Contact">Contact</a></li>
<li><a href="http://felix.apache.org/site/related-works.html" title="Related Works">Related Works</a></li>
<li><a href="http://felix.apache.org/site/article-presentations.html" title="Article &amp; Presentations">Article &amp; Presentations</a></li>
</ul>
<hr>
<div class="" align="center">
<p><span class="nobr"><a href="http://cwiki.apache.org/confluence/createrssfeed.action?types=blogpost&amp;statuses=created&amp;statuses=modified&amp;spaces=FELIX&amp;labelString=iPOJO&amp;rssType=atom&amp;maxResults=10&amp;timeSpan=5&amp;publicFeed=true&amp;title=iPOJO%20Atom%20Feed" title="Stay tuned!" rel="nofollow"><img src="ipojo-ant-task_files/feed-icon-32x32.png" align="absmiddle" border="0"><sup><img class="rendericon" src="ipojo-ant-task_files/linkext7.gif" alt="" align="absmiddle" border="0" width="7" height="7"></sup></a></span></p></div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script src="ipojo-ant-task_files/ga.js" type="text/javascript"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-1518442-4");
pageTracker._trackPageview();
</script>
</td></tr></tbody></table>
</div>
</body></html>