我有一个项目,这是不是一个Spring应用程序。 我想在它使用AspectJ的注解。 注释类正在从另一个罐子我引用。 我已经提到低于POM的我的插件部分。 我生成成功,但Maven的控制台输出从来没有提到任何关于AspectJ的插件,还当我跑我的项目注释不工作。
我一直在试图找出什么是错的小时了,但不能弄明白。
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>it.cvc.ciscocommerce.lps.lp-commons</groupId>
<artifactId>lp-commons</artifactId>
</aspectLibrary>
</aspectLibraries>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>listpriceservice</warName>
</configuration>
</plugin>
<!-- Plugin for sdaas deployment. For compressing war to tar.gz -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/resources/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
这些是我正努力的方面库使用的jar定义的两个依赖性。
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.7.4</version>
</dependency>
罐子被编译罚款和我缓行使用它的又一个春天应用程序,但没有这一项。 在Spring应用程序,我甚至不具备插件定义Maven的方面。
当我运行Maven构建,在控制台我只看到下面列出的插件。
[DEBUG]目标:org.apache.maven.plugins:行家洁净的插件:2.5:清洁(缺省清洁)[调试]样式:正常
[DEBUG]目标:org.apache.maven.plugins:行家-编译器插件:3.1:编译(默认编译)[调试]样式:正常
[DEBUG]目标:org.apache.maven.plugins:行家资源-插件:2.6:testResources(缺省testResources)[调试]样式:正常
[DEBUG]目标:org.apache.maven.plugins:行家-编译器插件:3.1:testCompile(缺省testCompile)[调试]样式:正常
[DEBUG]目标:org.apache.maven.plugins:行家-万无一失-插件:2.12.4:测试(默认检验)[调试]样式:正常
[DEBUG]目标:org.apache.maven.plugins:行家-战争插件:2.4:战争(缺省战争)[调试]样式:正常
编辑 :阅读kriegaex的答案,关于pluginManagement VS插件后,我改变了我的POM如下。 请注意,我的项目并不多模块它只有一个POM。
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>it.cvc.ciscocommerce.lps.lp-commons</groupId>
<artifactId>lp-commons</artifactId>
</aspectLibrary>
</aspectLibraries>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>listpriceservice</warName>
</configuration>
</plugin>
<!-- Plugin for sdaas deployment. For compressing war to tar.gz -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/resources/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
当我这样做,我得到下AspectJ的处决执行标签下面的错误
插件执行未包括生命周期配置:org.codehaus.mojo:AspectJ的行家-插件:1.4:编译(执行:默认值,相:流程源)
作为回答不被调用就解决了我的AspectJ插件的最初版本更新我标志着这个问题。 我会打开我的其他问题的新问题。 由于kriegaex指着我正确的方向。