You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by offbynull-maven <of...@offbynull.com> on 2016/09/15 08:45:22 UTC
Mojos that instrument classes
What should the defaultPhase be for a Maven plugin that instruments
classes? Should it be PROCESS_CLASSES / PROCESS_TEST_CLASSES, or should
it be COMPILE / TEST_COMPILE?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Mojos that instrument classes
Posted by Martin Gainty <mg...@hotmail.com>.
this implementation of btrace instrumentation executes in process-resources phase
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<argument>-cp</argument>
<classpath/>
<argument>com.sun.btrace.compiler.Compiler</argument>
<argument>-d</argument>
<argument>${basedir}/target/classes/</argument>
<argument>${basedir}/src/main/resources/scripts/TraceScript.java</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
https://github.com/btraceio/btrace/blob/master/benchmark/pom.xml
does this answer your question?
Martin
----------------------------------------
> To: users@maven.apache.org
> From: offbynull-maven@offbynull.com
> Subject: Mojos that instrument classes
> Date: Thu, 15 Sep 2016 01:45:22 -0700
>
> What should the defaultPhase be for a Maven plugin that instruments
> classes? Should it be PROCESS_CLASSES / PROCESS_TEST_CLASSES, or should
> it be COMPILE / TEST_COMPILE?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Mojos that instrument classes
Posted by Martin Gainty <mg...@hotmail.com>.
you can manually bind btrace instrumentation to 'test-compile' <phase> specified within exec-maven-plugin e.g.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <phase>test-compile</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>${java.home}/bin/java</executable> <arguments> <argument>-cp</argument> <classpath/> <argument>com.sun.btrace.compiler.Compiler</argument> <argument>-d</argument> <argument>${basedir}/target/classes/</argument> <argument>${basedir}/src/main/resources/scripts/TraceScript.java</argument> </arguments> </configuration> </execution> </executions> </plugin>
perhaps it is best if we can see how you are currently binding btrace instrumentation ?
Martin
______________________________________________
> Subject: Re: Mojos that instrument classes
> To: users@maven.apache.org
> From: offbynull-maven@offbynull.com
> Date: Thu, 15 Sep 2016 08:33:11 -0700
>
> This is what I'm using right now, but I've found that my instrumentation
> mojo won't run if someone does "mvn test" or "mvn test-compile". The
> user has to explicitly ask maven to run it. For example, "mvn
> test-compile coroutines:test-instrument".
>
> Is there a way to automatically get my mojo to run whenever test or
> test-compile is run?
>
> On 9/15/2016 2:39 AM, Olivier Lamy wrote:
> > Hi
> > Process-classes sounds a good place in the lifecycle for this purpose
> >
> > HTH
> > Olivier
> >
> > On Thursday, 15 September 2016, offbynull-maven <
> > offbynull-maven@offbynull.com> wrote:
> >
> >> What should the defaultPhase be for a Maven plugin that instruments
> >> classes? Should it be PROCESS_CLASSES / PROCESS_TEST_CLASSES, or should it
> >> be COMPILE / TEST_COMPILE?
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Re: Mojos that instrument classes
Posted by offbynull-maven <of...@offbynull.com>.
This is what I'm using right now, but I've found that my instrumentation
mojo won't run if someone does "mvn test" or "mvn test-compile". The
user has to explicitly ask maven to run it. For example, "mvn
test-compile coroutines:test-instrument".
Is there a way to automatically get my mojo to run whenever test or
test-compile is run?
On 9/15/2016 2:39 AM, Olivier Lamy wrote:
> Hi
> Process-classes sounds a good place in the lifecycle for this purpose
>
> HTH
> Olivier
>
> On Thursday, 15 September 2016, offbynull-maven <
> offbynull-maven@offbynull.com> wrote:
>
>> What should the defaultPhase be for a Maven plugin that instruments
>> classes? Should it be PROCESS_CLASSES / PROCESS_TEST_CLASSES, or should it
>> be COMPILE / TEST_COMPILE?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojos that instrument classes
Posted by Olivier Lamy <ol...@apache.org>.
Hi
Process-classes sounds a good place in the lifecycle for this purpose
HTH
Olivier
On Thursday, 15 September 2016, offbynull-maven <
offbynull-maven@offbynull.com> wrote:
> What should the defaultPhase be for a Maven plugin that instruments
> classes? Should it be PROCESS_CLASSES / PROCESS_TEST_CLASSES, or should it
> be COMPILE / TEST_COMPILE?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy