Search code examples
eclipsemavenintegration-testingopenjpaopenejb

Set openejb javaagent in code?


I'm currently writing integration tests for a Java EE application and use openejb/openjpa. But as I'm using CMP I have to use a javaagent to enhance my classes. In maven I can configure my surefire plugin to do this enhancement, or better set the agent as vm parameter to the test.

But as I'm currently developing I like to run my tests quite often in eclipse. But there I don't want to set the agent all the time via

java -javaagent:openejb-javaagent-4.6.0.jar _\[other params...](other-params....html)

Does someone have a useful solution for this problem?


Solution

  • For testing in Eclipse purposes, I always create a variable that can be used in the VM arguments section of your Run Configuration. This way all you need to specify is something like ${agent} (or whatever you call it) rather than the full javaagent string.