Friday, October 19

Migrate existing OSGi projects to the latest Pax-Construct

I'm currently tinkering with a Maven mojo to help people migrate old Pax-Construct (0.1.x) and other OSGi projects to the new Pax-Construct layout. At the moment this mojo only captures the project layout and types of bundles (wrapper, compiled, imported, etc.) but will eventually include the actual bundle source, BND instructions, and other POM customization - like extra repositories.

To try out the new mojo, either download the latest 0.2.1-SNAPSHOT scripts and use the pax-validate command to pull down the latest maven-pax-plugin, or build from the latest sources.

Then go to your OSGi project and call:

mvn org.ops4j:maven-pax-plugin:0.2.1-SNAPSHOT:clone

which should generate both UNIX and Windows build scripts under the target folder.

Make sure the 0.2.1-SNAPSHOT Pax-Construct scripts are on your path, and cd to a temporary directory - you should then be able to call the generated build script, which will recreate the project structure using the latest Pax-Construct commands.

For example:

cd ~/Code/ops4j/pax/radman ; mvn org.ops4j:maven-pax-plugin:0.2.1-SNAPSHOT:clone

cd /tmp ; ~/Code/ops4j/pax/radman/target/pax-clone-radman

If you want to make sure there's only one main project, use the -DunifyRoot Maven property to bring any disconnected (ie. parent-less) modules under the same root project.

Feel free to try it out and feedback any issues / requests via the OPS4J JIRA site as usual - enjoy!


Glyn said...

Hi Stuart

Is there any (proper) documentation for the PAX utilities? ;-)

mcculls said...

Depends how you define 'proper' ;)

There's a quickstart page which also links to documentation for the various scripts and the maven-pax-plugin (as well as javadoc, source xref, etc.)

(it does assume you know a bit about Maven at the moment)

Let me know if there's anything obviously missing - I'm adding more examples and updating the FAQ as people ask questions...

Glyn said...


What I hadn't noticed was that the navigator bar on the LHS of the quickstart page actually links to documentation for the various scripts. For some reason, I was filtering that out and expecting to be able to find my way from the body of the page. Some comment like "you can find documentation using the links on the left" would help. Maybe this is unfamiliarity with Maven-generated doc. on my part.

mcculls said...

I've tweaked the navbar headings and the CSS to make things a bit clearer, HTH