<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<mainClass>com.test.MainClass</mainClass>
<arguments>
<argument>-javaagent:target/final-jar.jar</argument>
</arguments>
</configuration>
</plugin>
The final-jar.jar has a manifest file with 'premain'; however, it is not never executed. Can someone help here?
The following worked for me finally. I changed the tag to tag. And it worked.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<mainClass>com.test.MainClass</mainClass>
<commandlineArgs>-javaagent:target/final-jar.jar</commandlineArgs>
</configuration>
</plugin>
This works with the maven goal 'java' of the 'exec-maven-plugin'.