我写的 = maven插件
B =使用A作为构建过程的一部分的maven项目
当我使用maven构建A时,aspectj按预期工作,我在单元测试期间点击了我的切入点。我使用aspectj-maven-plugin来构建它,因为我使用maven构建了一个。
问题是当我使用maven构建B并将A作为插件依赖项包含时,在构建过程中执行A时,我没有点击我的切入点。
我尝试在B中包含aspectj-maven-plugin来解决这个问题,但没有运气。我还在B中尝试了各种形式的配置以尝试解决此问题。目前,我对B的配置如下:
<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>