-
Notifications
You must be signed in to change notification settings - Fork 14
Using a custom transformer with dependencies
Stéphane Nicolas edited this page Jun 17, 2014
·
1 revision
If your custom transformer relies on dependencies, you can easily add them to the javassist-maven-plugin when you use your transformer in your project's build :
Suppose you have a project that will use the javassist-maven-plugin with a custom transformer com.example.MyTransformer
and this transformer uses the maven dependency :
<dependency>
<groupId>com.example</groupId>
<artifactId>dependency</artifactId>
<version>${dependency.version}</version>
</dependency>
Then, you can add this configuration to your project's build :
<plugin>
<groupId>com.github.drochetti</groupId>
<artifactId>javassist-maven-plugin</artifactId>
<version>${javassist-maven-plugin.version}</version>
<configuration>
<includeTestClasses>false</includeTestClasses>
<transformerClasses>
<transformerClass>
<className>com.example.MyTransformer</className>
</transformerClass>
</transformerClasses>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>javassist</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>dependency</artifactId>
<version>${dependency.version}</version>
</dependency>
</dependencies>
</plugin>