In place update of update site with tycho

1.3k Views Asked by At

I'm using tycho to build an Eclipse RCP application. So far we've been using Eclipse's build system, but I want to use tycho do build nightly snapshots. Until now, at my company, we've been releasing this RCP application with update-sites, which we update using 'Build All' in the view of the site.xml file in Eclipse. I tried to replicate this behavior with tycho, following http://www.vogella.com/articles/EclipseTycho/article.html.

My problem is that, despite having put a pom.xml within our existing update site, tycho generates a fresh update site when building (using mvn clean verify or mvn install), within the existing update-site, in the directory target/. If I build twice in a row, the first freshly generated update site gets replaced, whereas I would like it to be updated. It seems feasible to me, since the generated JARs do not have the same timestamps.

Hence, my question is: How do I mimic Eclipse's 'Build All' behavior that updates the site.xml, artifacts.jar, and contents.jar files (so that my clients see the edge and older versions on the update site) ? As a bonus, I would also prefer to update the existing update site that generating a fresh one in target/!

The pom.xml in my existing update-site is pretty standard:

 <project>
   <modelVersion>4.0.0</modelVersion>

      <parent>
        <relativePath>../../daily-build-repo/blah/pom.xml</relativePath>
        <groupId>com.mycompany</groupId>
        <artifactId>product_name</artifactId>
        <version>1.0.0-SNAPSHOT</version>
      </parent>

      <artifactId>com.mycompany.updateSites.nightly</artifactId>
      <packaging>eclipse-repository</packaging>

  </project> 

[edit] oberlies'answer made me progress, but it's not working yet. To make his answer more precise, let me add that I added his code in the pom.xml in the repository built by maven, NOT the one that I wanna publish (hence there's no reference in the master pom to the update site I wanna publish). This seems to work as the build ends with:

[INFO] Mirroring to path/to/existing/update/site

But then I get a big warning:

[WARNING] Mirror tool: Problems resolving provisioning plan.: [Unable to satisfy dependency from com.mycompany.blah to org.eclipse.ltk.ui.refactoring 0.0.0; Unable to satisfy dependency from com.mycompany.blah to org.eclipse.ltk.ui.refactoring 0.0.0; ...]

All missing dependencies are external libraries, not my company's libraries (that are built). As ALL libraries cannot be resolved, I guess I'm doing something wrong. What's weird is that, as shown in the snippet, I get missing dependencies for the same library twice: both for the version (3.7.0) coming from com.mycompany.blah's plugin.xml file and the version 0.0.0.

Despite that the build succeeds, my update site stays untouched. [/edit]

1

There are 1 best solutions below

0
On

It is a convention in Maven to use the build output directory (target/) only for output, i.e. existing files will not affect the build result. (IMHO this makes a lot of sense.)

So for adding content to an existing p2 repository, you need a two-step approach: First build the new content as new, separate p2 repository, and then copy the new content into the existing repository (aka "update site"). You can even do this in the same build:

  • Set up a normal eclipse-repository module to aggregate the new content.
  • In that module, add the following build step:

    <plugin>
       <groupId>org.eclipse.tycho.extras</groupId>
       <artifactId>tycho-p2-extras-plugin</artifactId>
       <version>${tycho-extras-version}</version>
       <executions>
          <execution>
             <id>add-to-update-site</id>
             <phase>install</phase>
             <goals>
                <goal>mirror</goal>
             </goals>
             <configuration>
                <source>
                   <repository>
                      <url>${project.build.directory}/repository</url>
                   </repository>
                </source>
                <destination>path/to/existing/update/site</destination>
                <append>true</append>
             </configuration>
          </execution>
       </executions>
    </plugin>