Time for action – building an update site

The update site created in Chapter 10, Adding an Update Site, is used to provide a standard hosting mechanism for Eclipse plug-ins and features. This can be built automatically with Tycho as well.

  1. Move the com.packtpub.e4.update project underneath the com.packtpub.e4.parent project.
  2. Add the line <module>com.packtpub.e4.update</module> to the parent pom.xml file.
  3. Copy the pom.xml file from the clock plug-in to the update project.
  4. Modify the packaging type to <packaging>eclipse-repository</packaging>.
  5. Change the artifactId to com.packtpub.e4.update.
  6. The resulting pom.xml file will look like:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                         http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>com.packtpub.e4</groupId>
        <artifactId>com.packtpub.e4.parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
      </parent>
      <artifactId>com.packtpub.e4.update</artifactId>
      <packaging>eclipse-repository</packaging>
    </project>
  7. Rename the site.xml file to category.xml.
  8. Verify that the category.xml file does not contain a url attribute and the version attribute is 0.0.0, as otherwise an Unable to satisfy dependencies error may be seen:
    <feature id="com.packtpub.e4.feature" version="0.0.0">
  9. Run mvn package from the parent project, and it should now build the update site as well:
    [INFO] Reactor Summary:
    [INFO]
    [INFO] com.packtpub.e4.parent .................. SUCCESS [0.048s]
    [INFO] com.packtpub.e4.clock.ui ................ SUCCESS [1.416s]
    [INFO] com.packtpub.e4.feature ................. SUCCESS [0.074s]
    [INFO] com.packtpub.e4.update .................. SUCCESS [2.727s]
    [INFO]
    [INFO] BUILD SUCCESS
    
  10. In the host Eclipse, install the update site by going to the Help | Install New Software menu, typing file:///path/to/com.packtpub.e4.parent/com.packtpub.e4.update/target/repository into the work with field, and installing the feature shown there. If it is not shown, uncheck the Group items by category checkbox.
  11. Restart the host Eclipse after installing the plug-ins, and show the Time Zone View by navigating to Window | Show View | Other… | Timekeeping | Time Zone View.

What just happened?

Creating an update site is no different from creating a plug-in or feature project. There is a pom.xml file that defines the name of the update site itself, and it uses or detects the file called category.xml to generate the update site.

The category.xml file is functionally equivalent to the site.xml file created previously, and is a name change introduced by P2 long ago. However, the update site project still generates it using the old name, so it is necessary to rename it from site.xml to category.xml in order to be built with Tycho.

As with the Eclipse update project, when the update site is built, the versions of the features and plug-ins in the category.xml are replaced with the versions of the features and plug-ins just built.

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

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