Time for action – exporting a feature

Once a feature has been created and has one or more plug-ins added, they can be exported from the workbench. An exported feature can be installed into other Eclipse instances, as the next section will demonstrate. Note that exporting a feature also builds and exports all the associated plug-ins.

  1. To export a plug-in, go to File | Export | Deployable features. This will give a dialog with the option to select any features in the workspace.
  2. Choose the com.packtpub.e4.feature and give a suitable directory location:
    Time for action – exporting a feature
  3. Click on Finish and the feature and all of its plug-ins will be exported.
  4. Open the destination location in a file explorer and see the files created:
    • artifacts.jar
    • content.jar
    • features/com.packtpub.e4.feature_1.0.0.201605260958.jar
    • plugins/com.packtpub.e4.clock.ui_1.0.0.201605260958.jar

What just happened?

The File | Export | Deployable features action performed a number of steps under the covers. First, it compiled the referenced plug-ins into their own JARs. It then zipped up the contents of the feature project, and finally moved them both into the directory under the features and plugins subdirectories.

When a feature is exported, the associated plug-ins are built, and so problems in exporting are often caused by problems in compiling the plug-ins.

To debug problems with plug-in compilation, check the build.properties file. This is used to control the ant-based build that PDE uses under the covers. Sometimes PDE will flag warnings or errors in this file, especially if the source or compilation folders are moved or renamed after creating a project.

A build.properties file looks like:

source.. = src/
output.. = bin/
bin.includes = plugin.xml,
               META-INF/,
               .,
               icons/

If there are any problems, verify that these correspond to paths in the plug-in's directory.

The source.. is actually a reference to the current directory. If there are multiple JARs being created, then this will read source.a.jar and source.another.jar. The source directive is used if plug-ins have source exported; classes and other compiled output come from the output property. If the output directory is renamed (for example, target/classes) then ensure that the output.. property is updated in the build.properties file.

If there are non-Java assets that need to be exported, they must be explicitly listed in this file. If a directory (such as icons/) is included, then this path will be re-created in the plug-in's Jar structure when it is created. Individual assets underneath the icons/ folder do not need to be explicitly listed.

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

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