2

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]

4

1 回答 1

2

Maven 的惯例是仅使用构建输出目录(target/)进行输出,即现有文件不会影响构建结果。(恕我直言,这很有意义。)

因此,要将内容添加到现有 p2 存储库,您需要一个两步方法:首先将新内容构建为新的独立 p2 存储库,然后将新内容复制到现有存储库(也称为“更新站点”)。您甚至可以在同一个版本中执行此操作:

  • 设置一个普通的eclipse-repository模块来聚合新的内容。
  • 在该模块中,添加以下构建步骤:

    <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>
    
于 2013-12-13T12:11:20.433 回答