Kaare Nilsen wrote:
On 12/01/07, Terry C Martin <[EMAIL PROTECTED]> 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 :
maven-surefire-plugin
once
-javaagent:${user.home}/.m2/repository/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar
or the more robust:
-javaagent:${localRepository}/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar
--
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]