Search code examples
mavenpluginsexecmaven-assembly-plugin

Calling maven exec plugin after src has been compiled and before it is packaged


I want to modify classes using ASM. I want to use Exec plugin (or any other alternatives that folks here suggest), to modify the classes after the compilation is done, but before it is jarred (packaged). Any suggestions on how I could do this with maven ?

thanks


Solution

  • Welcome to Stack Overflow.

    It seems that no plugin exists for ASM, but as far as I understand, the better solution would be to develop a plugin, that do what you want. Developing plugins is quite easy.

    Bind it to compile phase, and that OK.

    If you really don't want to develop a plugin, you should do something like that :

     <plugin>
            <artifactId>maven-exec-plugin</artifactId>
            <version>???</version>
            <executions>
                <execution>
                    <!-- The name you want, no really matter -->
                    <id>asm-compile</id>
                    <configuration>
                        ...
                    </configuration>
                    <!-- The phase you want to bind to -->
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>