by Lars Vogel

Follow me on twitter

Lars Vogel on Google+

Eclipse Feature and Fragment Projects - Tutorial

Lars Vogel

Version 2.1

14.01.2012

Revision History
Revision 0.1 30.11.2008 Lars
Vogel
created
Revision 0.2 - 2.1 20.04.2009 - 14.01.2012 Lars
Vogel
bug fixes and enhancements

Eclipse Feature Project

This tutorial describes the purpose and usage of Eclipse feature projects and Fragments.


Table of Contents

1. Feature Project
2. Fragment Project
3. Thank you
4. Questions and Discussion
5. Links and Literature
5.1. Eclipse resources
5.2. vogella Resources

1. Feature Project

An Eclipse feature project contains features. A feature has a name, version number and a software license and summarize a list of plug-ins and other features which can be understood as a logical unit.

A feature is described via a "feature.xml" file in the Eclipse feature project.

Features are used for the Eclipse update manager, the build process and optionally for the definition of Eclipse products. Features can also be used as the basis for a launch configuration.

Eclipse provides several predefined features, e.g. org.eclipse.rcp for Eclipse 3.x based RCP applications or org.eclipse.e4.rcp for Eclipse 4.x based RCP applications.

You can create a new feature project via the following menu path. File NewOtherPlug-in Development Feature Project .

If you open the "feature.xml" you can change the feature properties via a special editor.

The tab "Plug-ins" allows you to change the included plug-ins in the feature.

The "feature.xml" file is a simple text file. For example the "feature.xml" file might look like the following in a text editor.

			
<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="de.vogella.featuretest.feature"
      label="Feature"
      version="1.0.0.qualifier">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

   <plugin
         id="de.vogella.featuretest.testplugin"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>

		

2. Fragment Project

A fragment project is always defined for a host project. At runtime the fragment project is merged with its host project and for the runtime both projects are just one.

Fragments are always optional for their host plug-in.

Fragments are typical used for containing the tests. This ways the tests can access the host plug-in classes, even if the host plug-in does not define them as external API. Sometimes tests are also contained in normal plug-ins, in this case they can only test the external API for other plug-ins.

Another typical usage of fragments are translations. A new translation can be contributed to a plug-in via a fragment project.

3. Thank you

Please help me to support this article:

Flattr this

4. Questions and Discussion

Before posting questions, please see the vogella FAQ. If you have questions or find an error in this article please use the www.vogella.de Google Group. I have created a short list how to create good questions which might also help you.

5. Links and Literature

5.1. Eclipse resources

The Eclipse p2 update wiki

5.2. vogella Resources

Eclipse RCP Training (German) Eclipse RCP Training with Lars Vogel

Android Tutorial Introduction to Android Programming

GWT Tutorial Program in Java and compile to JavaScript and HTML

Eclipse RCP Tutorial Create native applications in Java

JUnit Tutorial Test your application

Git Tutorial Put everything you have under distributed version control system