In one of our projects we use Spring + EclipseLink with runtime weaving. To achieve Entity enhancement in our tests we have to run them with flag 'javaagent':
Finally, here is pom.xml snippet with surefire configuration.
java ... -javaagent:path/to/spring-instrument.jarThe project is based on maven and we wanted to keep smooth build procedure. Thus we had to provide path/to/spring-instrument.jar in an environment independent way. And solution for this was to:
- Add maven dependency on the spring-instrument.jar with test scope
- Configure maven-surefire-plugin with the mentioned argLine referencing spring-instrument.jar in the maven local repository by using maven variable settings.localRepository
Finally, here is pom.xml snippet with surefire configuration.
<plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine>-javaagent:${settings.localRepository}/org/springframework/spring-instrument/3.1.0.RELEASE/spring-instrument-3.1.0.RELEASE.jar</argLine> </configuration> </plugin>
No comments:
Post a Comment