Skip to content
Mickael Istria edited this page Jun 12, 2013 · 5 revisions

This repository contains some utils Maven plugins that are developed and used in the context of (JBoss Tools)[http://www.jboss.org/tools], They are mostly targetting builds of Eclipse artifacts with (Tycho)[http://eclipse.org/tycho]

  • Current version is 0.16.0.CR1 and is compatible with Tycho 0.16 and later (tested until 0.18)
  • Current snapshot is 0.16.0-SNAPSHOT and is compatible with Tycho 0.16 and later (tested until 0.18)

Maven repositories

Those artifacts are made public on JBoss Nexus repository. In order to use them, add the JBoss Nexus repository either to your pom.xml or settings.xml:

<pluginRepositories>
  <pluginRepository>
    <id>jboss-public-repository-group</id>
    <name>JBoss Public Repository Group</name>
    <url>http://repository.jboss.org/nexus/content/groups/public/</url>
  </pluginRepository>
  <pluginRepository>
    <id>jboss-snapshots-repository</id>
    <name>JBoss Snapshots Repository</name>
    <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
  </pluginRepository>
</pluginRepositories>

Usage

Repository Utils

Generate some additional stuff on an eclipse-repository

This Mojo allows to add to p2 repository produced by Tycho some more suger:

  • An index.html listing IUs (overridable template)
  • p2 stats URL
  • Some more additional sites (ie references)

You can use it as follows

<build>
  ...
  <plugins>
     <plugin>
        <groupId>org.jboss.tools.tycho-plugins</groupId>
        <artifactId>repository-utils</artifactId>
        <version>0.16.0-SNAPSHOT</version>
        <executions>
           <execution>
              <id>generate-facade</id>
              <phase>package</phase>
              <goals>
                 <goal>generate-repository-facade</goal>
              </goals>
              <configuration>
                  <!-- Symbols are used while expanding index.html template -->
                  <symbols>
                      <update.site.name>My p2 Repo</update.site.name>
                      <update.site.description>Use this URL in Eclipse to install awesome stuff</update.site.description>
                 </symbols>
                 <p2StatsUrl>http://server.org/url/where/to/push/stats</p2StatsUrl>
                 <associateSites>
                   <site>http://download.eclipse.org/releases/kepler</site>
                 </associateSites>
            </configuration>
          </execution>
       </executions>
     <plugin>
  <plugins>
<build>

To override the HTML template and web resources

  1. Create a folder siteTemplate somewhere in your project
  2. Create an index.html file in this folder. This index.html file is a template for the output index.html of the mojo. This index.html can use relative path to reference resources in the siteTemplate folder. For instance, if siteTemplate contains a file in web/style.css, you can reference web/style.css from your template file. The expanded template will correctly resolve this reference.
  3. Add the following configuration to the mojo execution:
  4. <siteTemplateFolder>path/to/your/custom/folder</siteTemplateFolder>
  5. Optional, <indexName>index.html</indexName> so you can set another name that index.html to your template (for example index.xhtml)

What is modified in templates:

  • String ${site.contents} gets replaced by a table containing the list of features, versions and categories that fit into
  • For each symbol <key>value</key> defined in the <symbols> tag of configuration, the string ${key} in HTML template gets replaced by the string value.

Target Platform Utils

Update versions of IUs in .target file

Assuming you have a Maven project definiing a .target file, you can get the versions of IUs immediatly updated by:

  1. Setting URLs of new repositories 2 run mvn org.jboss.tools.tycho-plugins:target-platform-utils:0.16.0-SNAPSHOT:fix-versions -DtargetFile=jbosstools-multiple.target

This will look for available updates of IUs in new site. It will fail if an IU cannot be resolved. The output is ${targetFile}_fixedVersions and a summary of changes can be found ${targetFile}_update_hints.txt

Create a repository that aggregates target platform definition content

<build>
  <plugins>
    <plugin>
      <!-- Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=389052  -->
      <groupId>org.jboss.tools.tycho-plugins</groupId>
      <artifactId>target-platform-utils</artifactId>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>mirror-target-to-repo</goal>
          </goals>
        </execution>
      </executions>
    <plugin>
  </plugins>
</build>

By default, it looks for ${artifactId}.target but this can be overriden using the sourceTargetFile or sourceTargetArtifact (referencing a GAV) parameter.

Create an "aggregated" target definition from a "composite" one

This is useful if you are merging multiple sites in a target-definition into a single one and want to create a target definition referencing this aggregate site. The parameter targetRepositoryURL is used to set the expected URL of the single repository in new target definition.

<plugin>
  <groupId>org.jboss.tools.tycho-plugins</groupId>
  <artifactId>target-platform-utils</artifactId>
  <executions>
    <execution>
      <id>create-target</id>
      <phase>generate-resources</phase>
      <goals>
        <goal>flatten-target</goal>
      </goals>
      <configuration>
        <sourceTargetArtifact>
          <groupId>${project.groupId}</groupId>
          <artifactId>jbosstools-multiple</artifactId>
          <classifier>jbosstools-multiple</classifier>
          <version>${project.version}</version>
        </sourceTargetArtifact>
        <targetRepositoryUrl>${targetRepositoryUrl}</targetRepositoryUrl>
      </configuration>
    </execution>
  </executions>
</plugin>