Java Reference
In-Depth Information
As the name implies,
PDE
was originally designed to support development of plug-
ins to Eclipse itself. In a sense,
OSG
i development is a side effect, and this shows in the
naming of many of the perspectives and views. If you mentally substitute
bundle
for
plug-in
, the purpose of various
GUI
elements may become clearer!
SETTING A CLASSPATH
If you've done normal Eclipse development, you've probably spent a lot of time editing
the project classpaths to add in all the libraries you need. One of the nice things about
OSG
i development in Eclipse
PDE
is that
you never need to touch the .classpath file
(or the classpath
GUI
) again. If you find
yourself editing it, you've most likely done
something wrong. Adjusting the classpath
directly bypasses
PDE
's manifest valida-
tion mechanism, so it's both unnecessary
and risky.
Instead of using a user-defined class-
path,
PDE
creates a plug-in dependencies
bucket
and adds that to the project class-
path. When you import a package from a
bundle,
PDE
adds that bundle to the plug-
in dependencies bucket. You can explore
the contents of the imported bundles in the
package explorer, as shown in figure 9.2.
Figure 9.2
Eclipse adds a plug-in dependencies
container to each project's classpath. Required
projects and JARs from the target platform are
added. If you're curious about what's on the
classpath, you can look inside each bundle by
expanding it.
DEFINING A TARGET PLATFORM
The contents of the plug-in dependencies container are drawn from other projects in
the workspace and the bundles in the
target platform.
By default, Eclipse uses itself as
the target platform, but it's easy to change it to point to a different runtime, folder, or
remote site (or any combination of the above!).
To define a new target platform, bring up the Eclipse preferences and navigate to
Plug-in Development > Target Platform. Choose Add and accept the default on the next
panel to start with nothing. You're developing for the Apache Aries sample assembly, so
point your target platform to your Aries install by clicking Add, and then Directory, and
then navigating to the directory where you've built the Aries assembly. After clicking
OK and selecting the Show Location Content check box, you can see that Eclipse has
added all the bundles in the Aries runtime to its target platform (figure 9.3).
SHARING A TARGET PLATFORM
The target platform definition can be saved as a .target file and checked into source
control, which makes it easy to ensure all members of a team are developing against
the same set of libraries.

