JBoss.org Community Documentation

11.1. AOP Compile with Maven2

The aop compile plugin is configured to run after the default maven compile phase has ended. By default it will try to find the jboss-aop.xml file in src/main/resources/jboss-aop.xml. It will also try to weave every class in $project.build.outputDirectory (usually target/classes). List of options:

  • aoppaths - an array of possible jboss-aop.xml files. Default is src/main/resources/jboss-aop.xml

  • verbose - if set to true it will provide debug information during the aop weaving. ' Default set to true.

  • suppress - suppress when a class cannot be found that a class references. This may happen if code in a class references something and the class is not in the classpath. Default set to true.

  • noopt - do not optimize the weaving. Default set to false.

  • report - store the output to a file (aop-report.xml). Default set to false.

  • includeProjectDependency - if set to true all project dependencies will also be included to the aop classpath. Only needed if a class inherits a class thats not defined in the current module. Default set to false.

  • classPath - classpath, by default set to null. If its set to null it will use the plugin dependencies (and add project dependencies if includeProjectDependency is set) + the output build path. Do not change this if you are not sure.

  • aopClassPath - load xml files that adds aspects to the manager. Do not change this if you are not sure. By default set to null.

  • includes - an array of classes that will be weaved. Note that if this is specified just the classes thats specified here will be weaved. Default set to null.

  • properties - a list of properties (name, value objects) that will be added as JVM properties. A small example:

    <properties>
      <property>
        <name>log4j.configuration</name>
        <value>log4j.properties</value>
      </property>
    </properties>

    This will add log4j.configuration as JVM properties like: -Dlog4j.configuration=log4j.properties.

There are a lot of options that can be set, but noone are mandatory (if they are mandatory they have a default value set). The average user would most likely only change aoppaths. A more complete example would look like:

<plugin>
  <groupId>org.jboss.maven.plugins</groupId>
  <artifactId>maven-jbossaop-plugin</artifactId>
  <version>1.0</version>
  <executions>
    <execution>
      <id>compile</id>
      <configuration>
      <!-- if you want to include dependencies from the current module
           (only needed if a class inherits a class thats not defined in this module
           -->
        <includeProjectDependency>true</includeProjectDependency>
        <aoppaths>
          <aoppath>src/main/resources/jboss-aop_test2.xml</aoppath>
          <!-- for a second jboss-aop.xml file
          <aoppath>src/main/resources/jboss-aop.xml</aoppath>
          -->
        </aoppaths>
        <!-- You can specify to only aopc a specific set of classes 
        <includes>
          <include>POJO.class</include>
        </includes>
        -->
      </configuration>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>