Setting up Eclipse and plugins

Installing Eclipse typically consists of downloading the latest distribution and unzipping it to a chosen location. Maybe then you can add a shortcut to its executable from a convenient place.

There are a few Eclipse packages based on the core Eclipse functionality and bundled with a selection of plugins that are mostly useful for a target application. For example, you'll find distributions for C/C++, PHP, or Java EE developers.

I'm working with Helios for Java EE. It comes with a combination of plugins that is suitable for a good range of Java development, and as all packages, it can be extended with a variety of plugins for additional features.

The two additional plugins that we're using in this appendix are:

Maven integration plugin

The integration of Maven with Eclipse is a great tool. It assists in the creation of new Maven projects by doing the leg work involved in the construction of the directory structure. It also configures the project to reflect its POM settings, adding JARs to the classpath, and so on.

Although I usually still prefer to use the mvn shell commands for the build, package, and deploy cycles of the main releases. The m2clipse plugin integration points with Maven provide hooks into the build cycle phases for quick test cycles between releases.

The most commonly used Maven phases can be launched through the run configurations provided (under the Run As and Debug As shortcuts). More customized build sequences can be configured using the "Maven build..." run configuration.

We'll install m2clipse in the following section.

Note

Another Maven plugin for Eclipse that's worth investigating is IAM (Integration for Apache Maven). To know more, you can go to http://www.eclipse.org/iam/.

OSGi framework container plugin

Another tool that's useful to have when developing for a framework is an embedded framework container. Embedding a framework in an IDE provides a test environment that's easy to obtain. This is especially useful in early testing phases, where there's a good chance that bundles are frequently updated to avoid disturbing the common continuous integration environment.

OSP4J Pax provides an Eclipse plugin, Pax Runner, which serves as a container to the most common OSGi frameworks, including Equinox, Knopflefish, and Felix.

Pax Runner will be installed in a bit and will be configured and used in the final sections of this appendix.

Choosing the workspace

A developer typically works on multiple project streams at a time, each with a set of deliverable projects. In Eclipse, workspaces are used to group projects that are related. A workspace keeps the related projects in a directory structure and uses that structure to add Eclipse and plugin-specific configuration. Then this configuration is applied to the Eclipse environment when switching workspaces.

Unless instructed otherwise, on startup, Eclipse will pop up the Workspace Launcher to prompt which workspace it should use. Otherwise, the workspace can also be switched through the File -> Switch Workspace menu option.

Choosing the workspace

In the example that we're using here, the code is structured under the directory C:/projects/felixbook/sources/. We will use this same location as our workspace.

Installing the Eclipse plugins

Installing plugins for Eclipse is pretty straightforward. Eclipse connects to a remote update site and downloads a descriptor that contains the plugins made available.

In this section, you'll cover the step-by-step approach for installing a plugin, using Pax Runner as an example. The information for the m2clipse plugin is provided later. Just follow the same process to install them both.

Installing Pax Runner

Eclipse has the concept of an update site, which is conceptually very closely related to the OBR repositories described in Chapter 6, Using the OSGi Bundle Repository. Each provider publishes a set of descriptors that list the software that it provides, made available at a URL. The user adds the update sites that are of interest to them and uses them to install new software components or to update existing software components.

To install Pax Runner, first launch the Install new software... wizard (through the Help menu item).

Installing Pax Runner

Then add a new update site for OPS4J Pax by clicking on Add.... The update site details for OSP4J Pax are as follows:

Note

The name of the update site is an arbitrary display name that you give to an update site. You can change it to a name of your choice.

With the update site added and selected, Eclipse will connect to the remote update site and retrieve a list of the available plugins.

Installing Pax Runner

Select the two Pax Runner plugins and continue by clicking Next. Eclipse will check for dependencies and determine the plugins to be installed. It then provides you with the plugin license terms.

Accept the terms of the licenses and finish the install. Once the installation is complete, restart Eclipse (if requested). If all went well, this set of plugins is now installed and you should be ready to use it to set up embedded OSGi platforms such as Felix.

To double check that your plugins are indeed installed, you can inspect the current installation through the Help -> About Eclipse menu sequence.

Installing m2clipse

Follow the previous procedure to install the m2clipse plugin, using the following update site details:

For the m2clipse install, you select the one provided plugin. For reference, the installation procedure can be found at the m2clipse site (http://m2eclipse.sonatype.org/installing-m2eclipse.html).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.35.72