<p>We've embedded an OSGi runtime (Equinox) into out custom client-server application to facilitate plugin development and so far things are going great. We've been using Eclipse to build plugins due to the built-in manifest editor, dependency management, and export wizard. Using Eclipse to manager builds isn't very conducive to continuous integration via Hudson.</p>

<p>We have OSGi bundles which depend on other OSGi bundles. I'd really hate to hardcode build order in a custom ANT build. We've done this is the past and it's pretty horrible. Is there any build tool that can EASILY manage OSGi dependencies, if not automatically resolve them? Are there any DECENT examples of how to this?</p>

<p>CLARIFICATION:</p>

<p>The generated build scripts are only usable via Eclipse. They require manually running pieces of Eclipse. We've also got some standard targets which the Eclipse build won't have, and I don't want to modify the generated file since I may regenerate (I know I can do includes, but I want to avoid the Eclipse gen file all together)</p>

<p>Here is my project layout:</p>

<pre><code>/
-PluginA
-PluginB
-PluginC
.
.
.
</code></pre>

<p>In using the Eclipse PDE, each plugin has a Manifest, but no build.xml as the PDE does that for me. Hard to automate a gui driven process w/ Hudson. I'd like to setup my own build.xml to build each, BUT there are dependencies and build order issues. These issues are driven by the Manifest files (which describe OSGi imports). For example, PluginC depends on PluginB which depends on PluginA. They must be built in the correct order. I realize that I can manually control the build order, I'm looking for a tool to help automate the build order dependency management.</p>

[{'answer_id': 45671, 'author': 'jamesh', 'author_id': 4737, 'author_profile': 'https://Stackoverflow.com/users/4737', 'pm_score': 1, 'selected': False, 'text': '<p>We use <a href="http://www.eclipse.org/buckminster/" rel="nofollow noreferrer">Buckminster</a>. It\'s a build and assembly framework, which takes care of the resolution of dependencies, the fetching from various repositories, building and packaging of the product.</p>\n\n<p>It\'s an Eclipse Tools project. It integrates well with PDE. </p>\n\n<p>This means that all the meta-data we use to build the RCP is useful to Buckminster to resolve and build. For example, feature.xml and the Require-Bundle header in the Manifest.MF, .product.</p>\n\n<p>We haven\'t got any build scripts in each bundle now; we now have a single build per product. Buckminster takes care walking the dependency graph.</p>\n\n<p>It took a little bit of effort to get our existing cruise-control/ant system working with it, though they (the Buckminster team) have started using Hudson to host the project itself. I believe that their build setup is also available for download.</p>\n\n<p>We\'re really impressed with it, despite it\'s relative infancy.</p>\n\n<p>We also looked into <a href="http://www.ops4j.org/projects/pax/construct/index.html" rel="nofollow noreferrer">Pax-Construct</a> but we didn\'t want to use Maven.</p>\n\n<p>We\'re also currently looking at <a href="http://static.springframework.org/osgi/docs/1.1.0/reference/html/testing.html" rel="nofollow noreferrer">Spring DM testing framework</a> to augment the unit testing effort.</p>\n'}, {'answer_id': 45786, 'author': 'Boris Terzic', 'author_id': 1996, 'author_profile': 'https://Stackoverflow.com/users/1996', 'pm_score': 3, 'selected': False, 'text': '<p>Maven2 all the way; has an Eclipse plugin called <a href="http://m2eclipse.codehaus.org/" rel="nofollow noreferrer">m2eclipse</a> to help with managing it, solves exactly the dependency problem and then some. Has a <a href="http://www.sonatype.com/community/definitive_guide.html" rel="nofollow noreferrer">free online book as documentation</a>.</p>\n\n<p>Specifically look at <a href="http://www.sonatype.com/book/reference/multimodule.html#" rel="nofollow noreferrer">multi-module projects</a> for bundling many components together and have Maven work out the build order and dependencies.</p>\n\n<p>There is also a <a href="http://www.sonatype.com/book/reference/eclipse.html#" rel="nofollow noreferrer">chapter on the Eclipse integration</a>.</p>\n\n<p>And that is just Eclipse and Maven, next you get some cool goodies for OSGi:</p>\n\n<ul>\n<li>The <a href="http://felix.apache.org/site/maven-bundle-plugin-bnd.html" rel="nofollow noreferrer">Apache Felix BND Maven plugin</a> will auto-generate your manifests or at the very least help you</li>\n<li>The <a href="http://www.ops4j.org/projects/pax/maven/" rel="nofollow noreferrer">PAX OPS4J project</a> and their Maven plugins can be a great help in bootstrapping projects, providing launchers, etc</li>\n</ul>\n\n<p>And just fundamentally, the Maven module model fits perfectly with OSGi\'s bundle model. We\'ve been building and managing multiple products with hundreds of bundles using Maven for more than 3 years now and it\'s great.</p>\n'}, {'answer_id': 46936, 'author': 'Andreas Kraft', 'author_id': 4799, 'author_profile': 'https://Stackoverflow.com/users/4799', 'pm_score': 0, 'selected': False, 'text': '<p>Can you please elaborate where the problem occurs? You mention OSGi bundle dependencies. Is this during runtime? Or during compile-time? In the first case you should consider Declarative Services (see OSGi Spec).</p>\n'}, {'answer_id': 208294, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>We use Hudson combined with <a href="http://www.pluginbuilder.org/" rel="nofollow noreferrer">PluginBuilder</a> to build our Eclipse-based OSGi bundles/plugins.  This builds upon Eclipse\'s standard PDE process for building plugins.  This means using Eclipse as the compiler.</p>\n'}, {'answer_id': 236483, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>Seconding Maven2. Look into the Tycho plugins for building - they use Eclipse's JDT compiler so it implements all of the OSGi rules at compile-time, the same way Eclipse does at runtime.</p>\n\n<p>Alternatively, the Apache Felix BND plugins also seem popular. I prefer Tycho because it more closely seems to unify the Maven and Eclipse development environments.</p>\n"}, {'answer_id': 478654, 'author': 'basszero', 'author_id': 287, 'author_profile': 'https://Stackoverflow.com/users/287', 'pm_score': 2, 'selected': True, 'text': "<p>Closing out some old questions...</p>\n\n<p>Our setup was not conducive to maven due to lack of network connectivity and timing. I know there are offline maven setups, but it was all too much given the time. Hopefully we'll get to use a proper setup when we've got time to reorganize the build process.</p>\n\n<p>The solution involved Ant, BND, and some custom ant tasks. The various bundle dependencies are manually managed. We were already using Ant; BND and custom tasks tied it all together. The custom tasks just made sure our bnd/eclipse projects were in sync.</p>\n"}, {'answer_id': 3135356, 'author': 'Kevin', 'author_id': 378364, 'author_profile': 'https://Stackoverflow.com/users/378364', 'pm_score': 1, 'selected': False, 'text': "<p>PDE Headless build.  It's well documented by Eclipse.  If you're building Eclipse plugins, and you want to do it via command line, The Eclipse PDE headless build is THE way to go.</p>\n"}, {'answer_id': 5155085, 'author': 'mike', 'author_id': 639398, 'author_profile': 'https://Stackoverflow.com/users/639398', 'pm_score': 0, 'selected': False, 'text': '<p>I use maven 3.0.2</p>\n\n<p>mvn generate:archetype</p>\n\n<pre><code>select 252 - osgi-archetype\nmvn idea:idea\n</code></pre>\n\n<p>see <a href="http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html" rel="nofollow">http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html</a></p>\n\n<p>to add your dependencies into the bundle use this short example in the pom.xml</p>\n\n<pre><code>&lt;Export-Package&gt;org.foo.myproject.api&lt;/Export-Package&gt;\n</code></pre>\n\n<p>or</p>\n\n<pre><code>&lt;Import-Package&gt;org.foo.myproject.api&lt;/Import-Package&gt;\n</code></pre>\n'}, {'answer_id': 6680679, 'author': 'Mircea D.', 'author_id': 842897, 'author_profile': 'https://Stackoverflow.com/users/842897', 'pm_score': 0, 'selected': False, 'text': "<p>Maven does not require internet connectivity! Use the -o switch, for Christ's sake.</p>\n"}]
['https://Stackoverflow.com/questions/27818', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/287/']