Features can be built in the same way as plug-ins, although this time the packaging type is eclipse-feature
.
com.packtpub.e4.feature
project underneath the com.packtpub.e4.parent
project.<module>com.packtpub.e4.feature</module>
to the parent pom.xml
file.pom.xml
file from the clock
plugin to the feature
project.<packaging>eclipse-feature</packaging>
.artifactId
to com.packtpub.e4.feature
.pom.xml
file will look like:<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/ POM/4.0.0 http://maven.apache.org/xsd/maven- 4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.packtpub.e4</groupId> <artifactId>com.packtpub.e4.parent</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <groupId>com.packtpub.e4</groupId> <artifactId>com.packtpub.e4.feature</artifactId> <!-- version>1.0.0-SNAPSHOT</version --> <packaging>eclipse-feature</packaging> </project>
mvn clean package
from the parent and it should build both the plug-in and the feature:[INFO] Reactor Summary: [INFO] [INFO] com.packtpub.e4.parent .................. SUCCESS [0.070s] [INFO] com.packtpub.e4.clock.ui ................ SUCCESS [1.872s] [INFO] com.packtpub.e4.feature ................. SUCCESS [0.080s] [INFO] BUILD SUCCESS
By adding the feature into the list of modules, the feature is built at the same time as everything else. The version of the plug-in built earlier is used to compose the feature contents. If the plug-in wasn't listed as part of the Maven build modules and it couldn't be resolved from a remote repository, then the build would fail.
The child module will inherit the groupId
and version
of the parent project, if specified. As a result, the version can be commented out (or removed), which makes managing the versions easier.
At present, the feature and plug-in are built but cannot be easily installed into an existing Eclipse instance. The assumption is that the plug-ins and features can be tested using PDE directly in Eclipse, and that, therefore, there's no need to directly install a plug-in or feature from the result of a build.
It's necessary to define an additional module—an update site—that will allow the plugin to be installed or hosted.