I have a Maven multi-module project that I would like to use aspects in. This
project consists of a parent module and several submodules. Including a
module that contains an aspect to weave the code for my logging into my
code. This is in fact all that this module contains. In the parent POM I
have put the maven-aspectj-plugin in the pluginManagement tag, specifying
the logging module as an aspectLibrary. Then in the submodule POMS that I
want to use logging in, I have specified the use of this plugin. 

However when I run the code, I only see the logging for the first project
that is built after the logging module, and not the second module where I
also specified the use of the logging module.

Any ideas what I might be doing wrong?

Regards,
Linda

Here's the pluginManagment code from the parent POM:
<pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>aspectj-maven-plugin</artifactId>
          <version>1.1</version>
          <configuration>
            <complianceLevel>1.6</complianceLevel>
            <aspectLibraries>
              <aspectLibrary>
                <groupId>nl.lunaris.bookdb</groupId>
                <artifactId>logging</artifactId>
              </aspectLibrary>
            </aspectLibraries>

          </configuration>
          <executions>
            <execution>
              <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>
        </plugin>
      </plugins>
    </pluginManagement>

And here's how I use it in a child POM:
...
<build>
...
    <plugins>
      <plugin>
        <artifactId>aspectj-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
      </plugin>
      ...
    </plugins>
</build>
<dependencies>
...
    <dependency>
      <groupId>nl.lunaris.bookdb</groupId>
      <artifactId>logging</artifactId>
      <version>${project.version}</version>
    </dependency>
</dependencies>
...
-- 
View this message in context: 
http://www.nabble.com/Problems-using-an-aspectLibrary-in-a-multi-module-project-tp24181457p24181457.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to