>Creating a P2 Zipped/Archived Site with Maven

>So you have created that nice P2 update size, using Tycho’s packaging option of eclipse-update-site. You even have it working to create an aggregated site. However, you miss the ability to have a Local Archived version for people to download, or better a P2 Zipped update site. We could call Ant/Antcontrib to generate this but that is so not Maven. The Maven way to do it…use the Assembly plugin.

The Assembly plugin allows you to specify what should be zipped and at what phase. To start with, add the following to your parent pom.xml under pluginManagement.

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <configuration>
     <descriptors>
        <descriptor>org.starstandard.releng/assembly.xml</descriptor>
     </descriptors>
  </configuration>
  <executions>
     <execution>
        <id>create-project-bundle</id>
        <phase>package</phase>
        <goals>
           <goal>single</goal>
        </goals>
     </execution>
  </executions>
</plugin>

In your update site projects pom.xml file add the following to the build section:

 <build>
      <plugins>
         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
               <finalName>site</finalName>
            </configuration>
         </plugin>
      </plugins>
   </build>

When you run the maven build with the install/package goals, the update site that is generated by your build will be archived into three formats. ZIP, TAR.GZ, and TAR.BZ2 formats. You can now download the P2 zipped file and use it as a local update site. One note on using this format, it puts all the files under a root site directory, so you can’t use this directly as a P2 archived zip file, but you can unzip it and use it as a Local Update site. If anybody knows how to exclude the extra root directory that is being created I would appreciate a note in the comments of this entry.

If you don’t want to control what files get added to the zip, and just want everything in the SITE directory, you can uncomment the includeSiteDirectory option in the assembly.xml file, and this will include the Site directory itself. However when it is added it is added as site/site/ in the archived files. There may be a way to control this using outputFileMapping but I haven’t tried yet.

Advertisements
This entry was posted in eclipse, maven, p2, tycho. Bookmark the permalink.

4 Responses to >Creating a P2 Zipped/Archived Site with Maven

  1. >You might consider moving to Tycho 0.9.0 and taking advantage of the changes brought in https://issues.sonatype.org/browse/TYCHO-258 ( tycho does not install/deploy packaged update site to maven repositories ).

  2. nickb says:

    >Why do you need three formats of update site when Linux understands zips? Surely the metadata includes permission/ownership instructions so you don't need a tarball?

  3. nickb says:

    >Just checked and your way results in the same output for me — but duplicates it entirely. Simpler is better!

  4. David Carver says:

    >@nickb If all you want is the ZIP output just remove the other formats.No extra time lost in the other formats being created.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s