tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Add P2 Manager Mojo to tycho-p2-extras-plugin

Open Copilot opened this issue 3 months ago • 2 comments

Overview

This PR adds a new p2-manager goal to the tycho-p2-extras-plugin that provides a convenient way to maintain, update, and manage the integrity of public P2 update sites. The mojo wraps the P2 Manager application from JustJ Tools and offers a much simpler and more validated configuration compared to using the eclipse-run goal directly.

Problem

Currently, using the P2 Manager from Maven requires a complex setup using the eclipse-run goal. This approach has several drawbacks:

  • Requires extensive knowledge of the P2 Manager application
  • Configuration is mostly a large block of text that is not validated
  • Easy to make mistakes with parameter names and values
  • No IDE support for configuration parameters
  • Poor discoverability of available options

Solution

This PR introduces a new tycho-p2-extras:p2-manager mojo that:

  • Sources the P2 Manager application from https://download.eclipse.org/justj/tools/updates/
  • Provides properly typed and validated Maven parameters for all P2 Manager options
  • Offers IDE auto-completion and parameter validation
  • Follows the same pattern as the SBOM generator mojo for consistency

Features

The P2 Manager helps with:

  • Promoting builds to update sites (nightly, milestone, or release)
  • Generating composite repositories
  • Managing repository history and retention policies
  • Creating browsable HTML pages for your update sites
  • Maintaining repository integrity

Example Usage

<plugin>
    <groupId>org.eclipse.tycho.extras</groupId>
    <artifactId>tycho-p2-extras-plugin</artifactId>
    <version>${tycho-version}</version>
    <executions>
        <execution>
            <id>promote-build</id>
            <goals>
                <goal>p2-manager</goal>
            </goals>
            <configuration>
                <root>${project.build.directory}/updatesite</root>
                <promote>file:${project.build.directory}/repository</promote>
                <timestamp>${maven.build.timestamp}</timestamp>
                <type>nightly</type>
                <retain>7</retain>
            </configuration>
        </execution>
    </executions>
</plugin>

Changes

  • New Mojo: P2ManagerMojo.java with comprehensive parameter mapping from the P2Manager application
  • Documentation:
    • Updated site.xml to link the new mojo under "Creating update sites using category.xml"
    • Added new section in Category.md with usage examples and parameter descriptions
    • Added entry to RELEASE_NOTES.md announcing the new feature
  • Parameters: All P2Manager application parameters are properly mapped including:
    • Basic: root, verbose, label, type, retain, timestamp
    • Promotion: promote, promoteProducts, buildUrl
    • UI customization: favicon, titleImage, bodyImage
    • Filtering: iuFilterPattern, primaryIUFilterPattern, excludedCategoriesPattern
    • Advanced: simrelAlias, bree, summary, mappings, etc.

Testing

  • Plugin compiles successfully with Java 21
  • Mojo is properly registered and discoverable via mvn help:describe
  • Parameter validation works correctly (e.g., required root parameter)
  • Can be invoked from command line and in pom.xml configurations

Fixes #[issue-number]

Original prompt

Create a new mojo for the P2 manager

Currently if one wants to use the P2 Manager (https://eclipse.dev/justj/?page=tools) from maven it requires a quite complex setup using the eclipse-run goal. While this works it has the drawback of require a lot of kowledge and configuration is mostly a large block of text that is not validated and easy to get wrong.

Instead we should supply a mojo that wrapps the application call like we did for the SBOM generator (tycho-sbom-plugin/src/main/java/org/eclipse/tycho/sbom/plugin/GeneratorMojo.java):

  • Create a new P2ManagerMojo mojo in the tycho-p2-extras-plugin that sources the application from https://download.eclipse.org/justj/tools/updates/ like in the SBOM Generator
  • Create mojo parameters from the P2Manager Application found in https://github.com/eclipse-justj/justj.tools/blob/master/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/P2Manager.java
  • Link the mojo under the "Creating update sites using category.xml" section in the site.xml
  • add a new section in the Category.md describing the mojo and a short introduction in what it does
  • add a new entry to the RELEASE_NOTES.MD so users getting aware of this new feature

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Oct 02 '25 05:10 Copilot

FYI @merks

laeubi avatar Oct 02 '25 06:10 laeubi

@waynebeaton again a request to provide something similar we have, but only as a rough concept.. generating a whole new thing! Obviously not just completely trivial even if repetitive of course. AI adds copyright header that claims I own the copyright.. Maybe we need some "AI Generated Content" or generic "The Eclipse/Tycho/.. Project team" Copyright header to used... would be good to have a general recommendation I think.

laeubi avatar Oct 09 '25 16:10 laeubi