You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Terry C Martin <tc...@yahoo.com> on 2007/01/12 22:34:48 UTC

Maven2 Surefire Aspectj LTW Spring Integration Tests Don't Work???

I have an application in which I make use of AspectJ Load-time-weaving to
inject pojos with services from Spring.  I have some integration tests which
test that the pojo is able to be injected and collaborate with the injected
service successfully.  These tests run successfully within Eclipse's
environment (I configured Eclipse's Installed JRE setting to set the
-javaagent:/aspectjweaver.jar).  When I back out onto the command prompt
(Windows XP) and set an environment variable: set
MAVEN_OPTS=-javaagent:/aspectjweaver.jar
where /aspectjweaver.jar happens to be on my c:\ drive and run 'mvn test' or
any derivatives thereof, the tests run as if there is no weaving happening. 
I suspect the maven surefire plugin isn't carrying over the javaagent
setting.  Maybe it's spawning a new process that does its own thing???  If I
actually run the app on command line through Maven (it's a web app
launchable through the maven Jetty plugin), weaving works, so it definitely
points towards there just being a problem with surefire plugin.

I've tried configuring the surefire plugin to fork a new process "once" &
"pertest" and set the "argLine" property with my javaagent setting to no
avail.

Has anyone gotten aspectj weaving to work outside of Eclipse within a maven
surefire test?

Thanks,
Terry
-- 
View this message in context: http://www.nabble.com/Maven2-Surefire-Aspectj-LTW-Spring-Integration-Tests-Don%27t-Work----tf2968462s177.html#a8306746
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven2 Surefire Aspectj LTW Spring Integration Tests Don't Work???

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Kaare Nilsen wrote:
> On 12/01/07, Terry C Martin <tc...@yahoo.com> wrote:
>>
>> I have an application in which I make use of AspectJ 
>> Load-time-weaving to
>> inject pojos with services from Spring.  I have some integration 
>> tests which
>> test that the pojo is able to be injected and collaborate with the 
>> injected
>> service successfully.  These tests run successfully within Eclipse's
>> environment (I configured Eclipse's Installed JRE setting to set the
>> -javaagent:/aspectjweaver.jar).  When I back out onto the command prompt
>> (Windows XP) and set an environment variable: set
>> MAVEN_OPTS=-javaagent:/aspectjweaver.jar
>> where /aspectjweaver.jar happens to be on my c:\ drive and run 'mvn 
>> test' or
>> any derivatives thereof, the tests run as if there is no weaving 
>> happening.
>> I suspect the maven surefire plugin isn't carrying over the javaagent
>> setting.  Maybe it's spawning a new process that does its own 
>> thing???  If I
>> actually run the app on command line through Maven (it's a web app
>> launchable through the maven Jetty plugin), weaving works, so it 
>> definitely
>> points towards there just being a problem with surefire plugin.
>>
>> I've tried configuring the surefire plugin to fork a new process 
>> "once" &
>> "pertest" and set the "argLine" property with my javaagent setting to no
>> avail.
>>
>> Has anyone gotten aspectj weaving to work outside of Eclipse within a 
>> maven
>> surefire test?
>
> Yupp :)
>
> add this to your build section :
>
> <plugin>
>    <artifactId>maven-surefire-plugin</artifactId>
>    <configuration>
>        <forkMode>once</forkMode>
> <argLine>-javaagent:${user.home}/.m2/repository/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar</argLine> 
>
or the more robust:
<argLine>-javaagent:${localRepository}/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar</argLine> 


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven2 Surefire Aspectj LTW Spring Integration Tests Don't Work???

Posted by Kaare Nilsen <ka...@gmail.com>.
On 12/01/07, Terry C Martin <tc...@yahoo.com> wrote:
>
> I have an application in which I make use of AspectJ Load-time-weaving to
> inject pojos with services from Spring.  I have some integration tests which
> test that the pojo is able to be injected and collaborate with the injected
> service successfully.  These tests run successfully within Eclipse's
> environment (I configured Eclipse's Installed JRE setting to set the
> -javaagent:/aspectjweaver.jar).  When I back out onto the command prompt
> (Windows XP) and set an environment variable: set
> MAVEN_OPTS=-javaagent:/aspectjweaver.jar
> where /aspectjweaver.jar happens to be on my c:\ drive and run 'mvn test' or
> any derivatives thereof, the tests run as if there is no weaving happening.
> I suspect the maven surefire plugin isn't carrying over the javaagent
> setting.  Maybe it's spawning a new process that does its own thing???  If I
> actually run the app on command line through Maven (it's a web app
> launchable through the maven Jetty plugin), weaving works, so it definitely
> points towards there just being a problem with surefire plugin.
>
> I've tried configuring the surefire plugin to fork a new process "once" &
> "pertest" and set the "argLine" property with my javaagent setting to no
> avail.
>
> Has anyone gotten aspectj weaving to work outside of Eclipse within a maven
> surefire test?

Yupp :)

add this to your build section :

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <forkMode>once</forkMode>
<argLine>-javaagent:${user.home}/.m2/repository/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar</argLine>
    </configuration>
</plugin>


/Kaare Nilsen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org