Configuring Aspectj in the surefire-plugin
takis Nov 27, 2014 4:34 AMHello all,
I am trying to configure the surefire-plugin in order to run my AspectJ - Arquillian test.
Here is my configuration, but it seems it does not work:
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.4</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Parameters to test cases. -->
<systemPropertyVariables combine.children="append">
<jboss.server.config.file.name>standalone-full.xml</jboss.server.config.file.name>
<jboss.inst>${basedir}/target/jbossas</jboss.inst>
</systemPropertyVariables>
<argLine>-XX:-UseSplitVerifier</argLine>
<argLine>-javaagent:${user.home}/.m2/repository/org/aspectj/aspectjweaver/1.8.4/aspectjweaver-1.8.4.jar</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<complianceLevel>1.7</complianceLevel>
<source>1.7</source>
<target>1.7</target>
<verbose>true</verbose>
<fork>true</fork>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Could you please help?
Thank you in advance,
Panagiotis
PS
This is my simple Aspect Class which is triggered when the variable count is set:
@Aspect
public class MetricAspect {
@Before("set (* org.jboss.as.test.smoke.datasource.count)")
public void advice(JoinPoint joinPoint) {
System.out.printf("MetricAspect.advice() .............. called on '%s'%n", joinPoint);
}
}