Fork me on GitHub

tycho-custom-bundle:custom-bundle

Full name:

org.eclipse.tycho.extras:tycho-custom-bundle-plugin:6.0.0-SNAPSHOT:custom-bundle

Description:

Creates a custom OSGi bundle by combining files from a base bundle location with additional file sets.

This plugin is useful when you need to create custom bundle variants with additional or modified content. It takes an existing OSGi bundle structure (with META-INF/MANIFEST.MF) and allows you to:

  • Include or exclude specific files from the base bundle location
  • Add additional files from other locations (like compiled classes, resources, etc.)
  • Attach the resulting bundle as an artifact with a custom classifier
  • Update the Bundle-Version in the manifest to match the expanded project version

Example Configuration

This example creates a custom bundle by combining a base bundle structure from the custom directory with compiled classes from the build output:

<plugin>
  <groupId>org.eclipse.tycho.extras</groupId>
  <artifactId>tycho-custom-bundle-plugin</artifactId>
  <version>${tycho-version}</version>
  <executions>
    <execution>
      <id>custom-bundle</id>
      <phase>package</phase>
      <goals>
        <goal>custom-bundle</goal>
      </goals>
      <configuration>
        <!-- Base bundle location containing META-INF/MANIFEST.MF -->
        <bundleLocation>${project.basedir}/custom</bundleLocation>
        
        <!-- Classifier for the attached artifact -->
        <classifier>attached</classifier>
        
        <!-- Optional: patterns to include from bundleLocation (default: **/*.*) -->
        <includes>
          <include>**/*.txt</include>
          <include>META-INF/**</include>
        </includes>
        
        <!-- Optional: patterns to exclude from bundleLocation -->
        <excludes>
          <exclude>**/*.bak</exclude>
        </excludes>
        
        <!-- Additional files to include in the bundle -->
        <fileSets>
          <fileSet>
            <directory>${project.build.outputDirectory}</directory>
            <includes>
              <include>**/*.class</include>
            </includes>
          </fileSet>
        </fileSets>
      </configuration>
    </execution>
  </executions>
</plugin>

Requirements

  • The bundleLocation directory must contain a valid OSGi manifest file at META-INF/MANIFEST.MF
  • The manifest must contain valid OSGi bundle headers (Bundle-SymbolicName, etc.)
  • At least one fileSet must be configured to specify additional files to include

Output

The plugin creates a JAR file named <artifactId>-<version>-<classifier>.jar in the project's build directory and attaches it to the project with the specified classifier. The Bundle-Version in the manifest is automatically updated to match the expanded version from the project (including qualifiers).

This plugin supports reproducible builds through the outputTimestamp parameter.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Since version: 0.14.0.

Required Parameters

Name Type Since Description
<bundleLocation> File - Location of OSGi bundle, must have META-INF/MANIFEST.MF bundle manifest file.
<classifier> String - Classifier of attached artifact.
<fileSets> List<DefaultFileSet> - Additional files to be included in the generated bundle.

Optional Parameters

Name Type Since Description
<archive> MavenArchiveConfiguration - No description.
<excludes> String[] - File patterns to exclude from bundleLocation.
<includes> String[] - File patterns to include from bundleLocation. Include everything by default.
<outputTimestamp> String - Timestamp for reproducible output archive entries, either formatted as ISO 8601 extended offset date-time (e.g. in UTC such as '2011-12-03T10:15:30Z' or with an offset '2019-10-05T20:37:42+06:00'), or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
Default: ${project.build.outputTimestamp}
<project> MavenProject - No description.
User Property: project

Parameter Details

<archive>

No description.
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • Required: No

<bundleLocation>

Location of OSGi bundle, must have META-INF/MANIFEST.MF bundle manifest file.
  • Type: java.io.File
  • Required: Yes

<classifier>

Classifier of attached artifact.
  • Type: java.lang.String
  • Required: Yes

<excludes>

File patterns to exclude from bundleLocation.
  • Type: java.lang.String[]
  • Required: No

<fileSets>

Additional files to be included in the generated bundle.
  • Type: java.util.List<org.codehaus.plexus.archiver.util.DefaultFileSet>
  • Required: Yes

<includes>

File patterns to include from bundleLocation. Include everything by default.
  • Type: java.lang.String[]
  • Required: No

<outputTimestamp>

Timestamp for reproducible output archive entries, either formatted as ISO 8601 extended offset date-time (e.g. in UTC such as '2011-12-03T10:15:30Z' or with an offset '2019-10-05T20:37:42+06:00'), or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
  • Type: java.lang.String
  • Required: No
  • Default: ${project.build.outputTimestamp}

<project>

No description.
  • Type: org.apache.maven.project.MavenProject
  • Required: No
  • User Property: project