Java Reference
In-Depth Information
Neither Osmorc nor NetBeans provides
OSG
i support that's as rich as that of bndtools
and Eclipse
PDE
. If you're using NetBeans as your development environment, you may
have to make some compromises in terms of how you structure your
OSG
i bundles, or
work against the
IDE
to some extent. Osmorc is more flexible and more closely aligned
with
OSG
i best practices, but you may find that it's adding only limited value compared
to using IntelliJ
IDEA
in its normal mode alongside a bnd-based Maven build.
9.2.3
Do you need OSGi support in your IDE?
If you're developing
OSG
i bundles using a code-first style, and you're not writing your
own bnd files, how much
OSG
i support any
IDE
—even Eclipse—can give you is lim-
ited. Luckily, this isn't such disappointing news as you might initially think. One of the
defining characteristics of the code-first style of
OSG
i development is that the code
development itself doesn't necessarily involve much
OSG
i. It arguably doesn't involve
any
OSG
i at all—the
OSG
i-ness gets added later, at build time. This means you can
choose to develop with whatever development tools you're most comfortable with.
If you're using Maven and the bundle plug-in, a popular choice is to use the Maven
Eclipse plug-in to align your
IDE
and your Maven build. The Eclipse plug-in creates
Eclipse projects for each of your Maven modules and ensures Eclipse knows where to
find all the source files and resources. If you'd like more complete integration, you
can use Eclipse's m2eclipse (m2e). The m2eclipse plug-in hooks the Eclipse compile
process into the Maven build process, so that Maven builds get used by Eclipse to com-
pile your code. This is the approach taken by the Apache Aries project, for example.
Maven also integrates nicely with other
IDE
s, including some we've discussed, like Net-
Beans and IntelliJ
IDEA
, and some we haven't, like Embarcadero's JBuilder.
9.3
Tools for the enterprise OSGi extensions
Although they offer varying levels of support for core
OSG
i, none of the development
tools we've discussed so far offer much support for the enterprise
OSG
i programming
model. Bndtools and
PDE
do have handy built-in support for Declarative Services, but
that's about the extent of enterprise
OSG
i support in what we've seen so far. But there
are several free tools built on top of Eclipse
PDE
that allow it to support development
of enterprise
OSG
i applications. Although this support isn't essential to code enter-
prise
OSG
i applications, you may find it useful.
9.3.1
IBM Rational Development Tools for OSGi Applications
The more mature of these tools,
IBM
Rational Development Tools for
OSG
i Applica-
tions, is a set of free tools that support Apache Aries development. The Rational tools
know about Blueprint,
WAB
s,
JPA
persistence bundles, and also
EBA
applications. They
also offer support for WebSphere Application Server concepts like composite bundles.
To install the tools, you'll need the Java
EE
version of Eclipse, version 3.6 or higher.
Bring up the Eclipse Marketplace from the Help menu and search for
OSG
i. The
Rational tools should be the first option.