Skip to content

Latest commit

 

History

History
102 lines (87 loc) · 3.6 KB

README.adoc

File metadata and controls

102 lines (87 loc) · 3.6 KB

Yupiik Maven Shade Transformers

Extensions to use with Apache Maven Shade.

Yupiik Fusion

Fusion provides some metadata files which need to be merged when used at runtime. This is typically the case for configuration metadata, OpenRPC metadata and JSON schema metadata.

For the first one just register the transformer FusionDocumentationTransformer, FusionOpenRPCTransformer for the second and for last one use FusionJsonSchemaTransformer. Both are in io.yupiik.maven.shade.transformer package:

<transformers>
  <transformer implementation="io.yupiik.maven.shade.transformer.FusionDocumentationTransformer" />
  <transformer implementation="io.yupiik.maven.shade.transformer.FusionJsonSchemaTransformer" />
  <transformer implementation="io.yupiik.maven.shade.transformer.FusionOpenRPCTransformer" />
</transformers>

Relocating Wrapper

This transformer aims at wrapping another transformer adding relocation capabilities to it (using relocations of the plugin). It supports a list of delegate transformers if needed.

Usage

This provides two transformer implementations which use slightly different replacement algorithms. * io.yupiik.maven.shade.transformer.RelocationTransformer: relocates class names * io.yupiik.maven.shade.transformer.SourceRelocationTransformer: relocates class names in source-like files * io.yupiik.maven.shade.transformer.PathRelocationTransformer: relocates paths (enabling to use rawString relocation configuration and use a plain replaceAll) * io.yupiik.maven.shade.transformer.ClassRelocationTransformer: similar to default one but filter replacements to classes only (safer).

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
                  <delegates>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.properties.PropertiesTransformer">
                      <resource>configuration/application.properties</resource>
                      <ordinalKey>ordinal</ordinalKey>
                    </transformer>
                  </delegates>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>io.yupiik.maven</groupId>
            <artifactId>maven-shade-transformers</artifactId>
            <version>0.0.1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  ...
</project>

Build

To build the project use:

mvn clean verify -Prun-its