Question

I have a spring tomcat project configured with aspectJ LTW, I would like to run unit tests with AspectJ LTW. According to the spring docs running with LTW for a standalone JVM requires passing in arguments for a JVM agent.

Passing a JVM agent to junit tests is easy to do from ant, but very inconvenient to do when running a unit test in eclipse. Is there any way to configure the JUnit classes, so that LTW is turned on without using an agent?

For tomcat spring uses a transforming class loader to load run AspectJ LTW, is there something similar for JUnit, maybe a JUnit runner that does LTW?

update: By telling eclipse to store the .launch files in the eclipse project I am able to right click on unit tests and do Run As and it works because eclipse uses the .launch files, this is a workaround that I would like to avoid if possible.

Was it helpful?

Solution

I would install the AspectJ Development Tools, that way you get your aspects woven right in your Eclipse IDE. That way you don't need any special launcher.

Since you are using Spring, think about using the SpringSource Tool Suite. It's an Eclipse distribution that includes Spring tools and the AspectJ Development Tools.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top