<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sonatype Blog &#187; pax</title>
	<atom:link href="http://blog.sonatype.com/people/tag/pax/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sonatype.com/people</link>
	<description>Sonatype is transforming software development with tools, information and services that enable organizations to build better software, faster, using open-source components.</description>
	<lastBuildDate>Thu, 16 May 2013 18:53:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Maven Tips and Tricks: Creating an OSGi Project with Maven</title>
		<link>http://blog.sonatype.com/people/2009/09/maven-tips-and-tricks-creating-an-osgi-project-with-maven/</link>
		<comments>http://blog.sonatype.com/people/2009/09/maven-tips-and-tricks-creating-an-osgi-project-with-maven/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 21:10:32 +0000</pubDate>
		<dc:creator>Tim O'Brien</dc:creator>
				<category><![CDATA[Book]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Sonatype]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[pax]]></category>

		<guid isPermaLink="false">http://www.sonatype.com/people/?p=2940</guid>
		<description><![CDATA[This post is a quick start guide to using the Maven PAX plugin to create OSGi project and start an OSGi runtime environment (Apache Felix). First, use the Maven Pax Plugin from OPS4J, and call the create-project goal. The following command-line will create a multi-module project with a groupId of org.sonatype.mhandbook, an artifactId of osgi-project, [...]]]></description>
				<content:encoded><![CDATA[<p>This post is a quick start guide to using the Maven PAX plugin to create OSGi project and start an OSGi runtime environment (Apache Felix).   First, use the Maven Pax Plugin from OPS4J, and call the create-project goal. The following command-line will create a multi-module project with a groupId of org.sonatype.mhandbook, an artifactId of osgi-project, and a version of 1.0-SNAPSHOT:</p>

<pre>~/examples/osgi $ mvn org.ops4j:maven-pax-plugin:create-project \
  -DgroupId=org.sonatype.mhandbook \
  -DartifactId=osgi-project \
  -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO] artifact org.ops4j:maven-pax-plugin: checking for updates from central
[INFO] Building Maven Default Project
[INFO]    task-segment: [org.ops4j:maven-pax-plugin:create-project] (aggregator
-style)
[INFO] [pax:create-project]
[INFO] Selecting latest archetype release within version range [1,2)
[INFO] artifact org.ops4j.pax.construct:maven-archetype-osgi-project: checking
for updates from central
[INFO] Using following parameters for creating Archetype: maven-archetype-osgi-
project:1.0.3
[INFO] Parameter: packageName, Value: org.sonatype.mhandbook.osgi-project
[INFO] Parameter: archetypeVersion, Value: 1.0.3
[INFO] Parameter: groupId, Value: org.sonatype.mhandbook
[INFO] Parameter: archetypeArtifactId, Value: maven-archetype-osgi-project
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: archetypeGroupId, Value: org.ops4j.pax.construct
[INFO] Parameter: basedir, Value: ~/examples/osgi
[INFO] Parameter: package, Value: org.sonatype.mhandbook.osgi-project
[INFO] Parameter: artifactId, Value: osgi-project
[INFO] ********************* End of debug info from resources from generated POM
[INFO] Archetype created in dir: ~/examples/osgi/osgi-project</pre>

<p>Once you&#8217;ve generated an OSGi project using the Pax Plugin, you will have the following directory structure:</p>

<p><span id="more-2940"></span></p>

<p><img class="aligncenter" title="Project Structure Created by the OPS4J Pax Plugin" src="http://www.sonatype.com/books/mhandbook/reference/figs/web/osgi_osgi-project-filesystems.png" alt="" width="450" height="350" /></p>

<p>If you want to verify that you can build the project successfully, run mvn clean install:</p>

<pre>~/examples/osgi/osgi-project $ mvn clean install
[INFO] Reactor build order:
[INFO]   org.sonatype.mhandbook.osgi-project (OSGi project)
[INFO]   osgi-project - plugin configuration
[INFO]   osgi-project - wrapper instructions
[INFO]   osgi-project - bundle instructions
[INFO]   osgi-project - imported bundles
[INFO] ------------------------------------------------------------------------
[INFO] Building org.sonatype.mhandbook.osgi-project (OSGi project)
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing ~/examples/osgi/osgi-project/target/pom-transformed.
xml to ~/.m2/repository/org/sonatype/mhandbook/osgi-project/1.0-SNAPS
HOT/osgi-project-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Building osgi-project - plugin configuration
[INFO]    task-segment: [clean, install]
...</pre>

<p>Instead of executing these goals manually, you can also download and install the Pax-Construct scripts which can be used to automate the process of creating a new OSGi project with the Pax plugin. For more information, see the Pax Construct Quickstart page.</p>

<p>The generated multi-module project structure contains a parent project with the supplied groupId, artifactId, and version, and a few submodules:</p>

<ul>
    <li><strong>osgi-project/pom.xml</strong>
This is the parent POM</li>
    <li><strong>osgi-project/poms/compiled/pom.xml</strong>
This POM serves as the parent POM to all of the compiled OSGi components you will add to this osgi-project Maven project.</li>
    <li><strong>osgi-project/poms/wrappers/pom.xml</strong>
If you can&#8217;t find a particular library as an OSGi component, the Pax Construct tools allow you to wrap an existing dependency artifact into an OSGi bundle. The configuration for these wrapped bundles is stored in this POM.</li>
    <li><strong>osgi-project/provision/pom.xml</strong>
This POM configures the Apache Felix runtime environment that you can start by running the pax:provision goal. If you need to import a bundle into your runtime environment, this is the POM that contains a reference to the corresponding Maven dependency.</li>
</ul>

<p>To start the Apache Felix container, run mvn install pax:provision from the osgi-project/  directory: </p>

<pre>~/examples/osgi/osgi-project $ mvn install pax:provision
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   org.sonatype.mhandbook.osgi-project (OSGi project)
[INFO]   osgi-project - plugin configuration
[INFO]   osgi-project - wrapper instructions
[INFO]   osgi-project - bundle instructions
[INFO]   osgi-project - imported bundles
...
[INFO] [pax:provision]
[INFO] ~~~~~~~~~~~~~~~~~~~
[INFO]  No bundles found!
[INFO] ~~~~~~~~~~~~~~~~~~~
    ______  ________  __  __
   / __  / /  __   / / / / /
  /  ___/ /  __   / _\ \ _/
 /  /    /  / /  / / _\ \
/__/    /__/ /__/ /_/ /_/
Pax Runner (1.0.0) from OPS4J - http://www.ops4j.org
----------------------------------------------------
 -> Using config [classpath:META-INF/runner.properties]
 -> Using only arguments from command line
 -> Scan bundles from [~/examples/osgi/osgi-project/runner/deploy-pom.xml]
 -> Scan bundles from [scan-pom:file:/~/examples/osgi/osgi-project/runner/deplo
y-pom.xml]
 -> Preparing framework [Felix 1.8.0]
 -> Downloading bundles...
 -> Using execution environment [J2SE-1.5]
 -> Runner has successfully finished his job!
Welcome to Felix.
=================
-> </pre>

<p>When you started up Felix, notice that the line directly following the execution of the pax:provision goal says &#8220;No bundles found!&#8221;. By running pax:provision, you&#8217;ve started the Felix OSGi service platform. Felix uses the configuration from a properties file and then scans two deploy-pom.xml files for bundles that it should download and install. Finding none, it presents a simple prompt and awaits orders. At this point, we have an empty container that isn&#8217;t running any custom logic or downloading any OSGi bundles. </p>

<p>Once you have the console for Felix loaded, you can control the platform, load components from remote repositories, list all of the running components, and start and stop components. Try executing the command help to see a list of available commands: </p>

<pre>-> help
bundlelevel <level> <id> ... | <id> - set or get bundle start level.
cd [<base-URL>]                     - change or display base URL.
exports <id> ...                    - list exported packages.
headers [<id> ...]                  - display bundle header properties.
help                                - display impl commands.
imports <id> ...                    - list imported packages.
install <url> [<url> ...]           - install bundle(s).
ps [-l | -s | -u]                   - list installed bundles.
refresh [<id> ...]                  - refresh packages.
requirers <id> ...                  - list requiring bundles.
requires <id> ...                   - list required bundles.
resolve [<id> ...]                  - attempt to resolve the specified bundles.
scr help                            - Declarative Services Runtime
services [-u] [-a] [<id> ...]       - list registered or used services.
shutdown                            - shutdown framework.
start [-t] <id> [<id> <url> ...]    - start bundle(s).
startlevel [<level>]                - get or set framework start level.
stop [-t] <id> [<id> ...]           - stop bundle(s).
uninstall <id> [<id> ...]           - uninstall bundle(s).
update <id> [<url>]                 - update bundle.
version                             - display version of framework.</pre>

<p>If you execute the ps command, you can see a list of bundles with IDs that are running in the Felix container. You can start and stop bundles by running start and stop followed by the ID of the specific bundle you want to control. You can also install and uninstall bundles in the running container.</p>

<p>For more information, read the <a href="http://www.sonatype.com/books/mhandbook/reference/sect-osgi-generate-project.html">OSGi chapter in the Maven Handbook</a>, it will walk you through the process of creating a new OSGi project and importing OSGi bundles into an OSGi container.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sonatype.com/people/2009/09/maven-tips-and-tricks-creating-an-osgi-project-with-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to OSGi with Pax, Maven, and Nexus Professional</title>
		<link>http://blog.sonatype.com/people/2009/07/introduction-to-osgi-with-pax-maven-and-nexus-professional/</link>
		<comments>http://blog.sonatype.com/people/2009/07/introduction-to-osgi-with-pax-maven-and-nexus-professional/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 15:34:31 +0000</pubDate>
		<dc:creator>Tim O'Brien</dc:creator>
				<category><![CDATA[Book]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[Nexus]]></category>
		<category><![CDATA[pax]]></category>

		<guid isPermaLink="false">http://www.sonatype.com/people/?p=2634</guid>
		<description><![CDATA[We&#8217;ve released a pre-alpha version of the Maven Cookbook which contains a chapter on OSGi development with Maven via the Pax plugin from OPS4J. This chapter contains a series of recipes which will walk you through the process of creating an OSGi project, importing bundles from both a Maven repository and existing OSGi Bundle Repositories [...]]]></description>
				<content:encoded><![CDATA[<p>We&#8217;ve released a pre-alpha version of the Maven Cookbook which contains a chapter on OSGi development with Maven via the Pax plugin from OPS4J.   This chapter contains a series of recipes which will walk you through the process of creating an OSGi project, importing bundles from both a Maven repository and existing OSGi Bundle Repositories (OBR), and executing an OSGi runtime environment all with the help of the Maven Pax Plugin.   The last few chapters provide a road map for developers interested in hosting and combining multiple Maven and OBR repositories into a single repository group with Nexus.</p>

<p>To read the pre-alpha, version 0.1.1 release of the Maven Cookbook, you can:</p>

<ul>
   <li><a href="http://tr.im/tc3l">Read the Maven Cookbook on Scribd</a></li>
   <li><a href="http://www.sonatype.com/books/mcookbook/reference/">Read the Cookbook Online</a></li>
   <li><a href="http://www.sonatype.com/maven/documentation/download-cookbook?file=books/maven-cookbook.pdf">Download a PDF of the Maven Cookbook</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.sonatype.com/people/2009/07/introduction-to-osgi-with-pax-maven-and-nexus-professional/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
