Usage

The JBoss-Retro Plugin transforms compiled byte code using javassist. By default no transformation will take place, so a basic configuration normally includes a weaverClass. This weaver class is a subclass of org.jboss.weaver.Weaver from the jboss-retro project.

For example, a jdk1.5 to jdk1.4 translator is included in jboss-retro, and can be used with the following configuration.

Minimal configuration

  <plugin>
    <groupId>org.jboss.maven.plugins</groupId>
    <artifactId>maven-jboss-retro-plugin</artifactId>
    <configuration>
      <weaverClass>org.jboss.weaver.retro.WeaverRetroJdk14</weaverClass>
    </configuration>
    <executions>
      <execution>
        <id>weave-classes</id>
        <goals>
          <goal>weave</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

This will output the transformed classes into the directory target/classes-weaved

The jboss-retro Plugin also includes goals for weaving the test classes, and for performing a validation check on the weaved code. Note: the [retro-check] goal is only useful when using the jdk1.5 to jdk1.4 transformation.

More complex configuration

  <plugin>
    <groupId>org.jboss.maven.plugins</groupId>
    <artifactId>maven-jboss-retro-plugin</artifactId>
    <configuration>
      <weaveClassifier>jdk14</weaveClassifier>
      <weaverClass>org.jboss.weaver.retro.WeaverRetroJdk14</weaverClass>
    </configuration>
    <executions>
      <execution>
        <id>weave-classes</id>
        <goals>
          <goal>weave</goal>
        </goals>
      </execution>
      <execution>
        <id>weave-test-classes</id>
        <goals>
          <goal>weave-tests</goal>
        </goals>
      </execution>
      <execution>
        <id>check-weave</id>
        <goals>
          <goal>retro-check</goal>
        </goals>
        <configuration>
          <checkDirectory>classes-jdk14</checkDirectory>
          <jvm>${java14_home}/bin/${javaExecutable}</jvm>
        </configuration>
      </execution>
      <execution>
        <id>check-weave-tests</id>
        <goals>
          <goal>retro-check</goal>
        </goals>
        <configuration>
          <checkDirectory>test-classes-jdk14</checkDirectory>
          <jvm>${java14_home}/bin/${javaExecutable}</jvm>
        </configuration>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
      </dependency>
    </dependencies>
  </plugin>