This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Page tree
Skip to end of metadata
Go to start of metadata

This page describes how one can use Clirr with Shade to compare components that have changed packages.

Clirr compares different versions of classes with the same package name Shade can be used to change package names throughout a jar file By combining the two, it is possible to use Clirr to check classes that are now in a new package.

The process is:

  • use Shade to convert the old package names to the new package names
  • install the shaded jar in the local repository
  • run Clirr against the shaded jar

Here is a sample POM (shade.xml) for comparing org.apache.bcel:bcel:5.2 against org.apache.commons:commons-bcel6:6.0

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>17</version>
    </parent>

  <!-- New Maven co-ordinates -->
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-bcel6</artifactId>
  <packaging>jar</packaging>
  <version>5.2-SHADED</version>
  <name>Commons BCEL shader</name>
  <description>
  This POM can be used to install a shaded version of BCEL 5.2
  in the local repo. Usage:

  mvn -f shade.xml install

  You can then run Clirr using the default POM:

  mvn clirr:clirr

  </description>
  <url>http://maven.apache.org</url>
  <properties>
    <!-- Ensure local files are not compiled -->
    <skipMain>true</skipMain>
    <skipTests>true</skipTests>
    <maven.main.skip>true</maven.main.skip>
    <maven.test.skip>true</maven.test.skip>
  </properties>
  <dependencies>
    <!-- Source jar -->
    <dependency>
      <groupId>org.apache.bcel</groupId>
      <artifactId>bcel</artifactId>
      <version>5.2</version>
      <!-- Exclude all dependencies, we don't want them in the shaded jar -->
      <exclusions>
        <exclusion>
          <groupId>jakarta-regexp</groupId>
          <artifactId>jakarta-regexp</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <!-- specify old and new base package names -->
              <relocations>
                <relocation>
                  <pattern>org.apache.bcel</pattern>
                  <shadedPattern>org.apache.commons.bcel6</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
  • No labels