The short answer: it didn't work. Surefire doesn't consider any of the dependencies when it starts the JVM to run the tests--it figures it will be applying those dependencies to the custom classloader it uses when it loads the test classes later on. There aren't any configuration properties in surefire to add to the JVM classpath.
We went a step further to work around this issue by putting all the classes from the dependent jars into the agent jar (so the agent jar is the only one that's necessary). That allowed the agent to load, but when the tests were run the agent wasn't there any more. I haven't gone into the surefire code to figure out why that would be. In our case, having the agent in place to run the tests wasn't essential, so we've given up on the whole thing. We'll just stick to the tests that don't need the agent. If you're able to get surefire to run correctly with an agent (which, I believe, will require some enhancements to surefire), I'll be interested. ..David.. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek Laskowski Sent: Thursday, April 05, 2007 9:00 AM To: [email protected] Subject: Re: How to pass M2 properties to surefire plugin's argLine On 4/5/07, David Jackman <[EMAIL PROTECTED]> wrote: > I'm trying to do almost exactly the same thing (different agent jar, > though). Rather than trying to have the agent point to the repo, I > used the dependency plugin to copy the jar from the repository to a > location under the build directory, then reference it there. That's the idea! Thanks for sharing it...so lightning fast. > That much is working okay. What isn't working now is the fact that my > java agent has dependencies of its own that aren't in the surefire > classpath. Wayne gave me something to try to get around this problem. Why doesn't declaring a dependency on the agent work? The deps should be managed by m2 and should be passed to surefire-plugin and be on the classpath. > I'll keep you posted on whether I'm able to get it all working. > Please do the same for me if you're able to get it working on your end. Definitely. Thanks again for the tip. Jacek -- Jacek Laskowski http://www.JacekLaskowski.pl --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
