aspectj within a maven plugin fails to call pointcut

138 views Asked by At

A = maven plugin I wrote

B = maven project that uses A as part of it's build process


When I use maven to build A, aspectj works as expected and I hit my pointcuts during my unit tests. I use the aspectj-maven-plugin to build it because I build A using maven.

The problem is when I use maven to build B and include A as a plugin dependency, I don't hit my pointcuts while A is executing during the build process.

I have tried include aspectj-maven-plugin in B to solve this, but no luck. I have also tried various forms of configuration in B in attempt to fix this issue. Currently, my configuration for B is as follows:

                   <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>compile</goal>
                                    <goal>test-compile</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.aspectj</groupId>
                                <artifactId>aspectjrt</artifactId>
                                <version>${aspectj.version}</version>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <source>${maven.compiler.source}</source>
                            <target>${maven.compiler.target}</target>
                            <complianceLevel>${maven.compiler.target}</complianceLevel>
                            <forceAjcCompile>true</forceAjcCompile>
                            <showWeaveInfo>true</showWeaveInfo>
                            <weaveWithAspectsInMainSourceFolder>true</weaveWithAspectsInMainSourceFolder>
                            <encoding>UTF-8</encoding>
                            <aspectLibraries>
                                <aspectLibrary>
                                    <groupId>com</groupId>
                                    <artifactId>A</artifactId>
                                </aspectLibrary>
                            </aspectLibraries>
                            <weaveDependencies>
                                <weaveDependency>
                                    <groupId>com</groupId>
                                    <artifactId>A</artifactId>
                                </weaveDependency>
                            </weaveDependencies>
                        </configuration>
                    </plugin>
0

There are 0 answers