How to use aspectj-maven-plugin

那年仲夏 提交于 2019-12-21 05:11:08

问题


I'm a newbie to AspectJ and Maven.

I'm trying to use aspectj-maven-plugin to build my project, but it does not work. I just followed the steps in AspectJ In Action 2nd Edition.

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>
                    </goals>

                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Here's the error message I get on the <execution> line:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (execution: default, phase: compile)

I'm using JDK6 and Apache Maven 3.0.4.


回答1:


You need to install the AspectJ Maven configurator. It is available here:

http://dist.springsource.org/release/AJDT/configurator/

Help -> Install new software...

Add this update site to the "work with" section and select the feature.




回答2:


To resolve this plugin execution issue with aspectj-maven-plugin, you can wrap your tag with tag in your pom.xml. This will remove the exception in eclipse.

Shown as below:

<build>
    ....
    <pluginManagement>
        <plugins>
            <plugin> ... </plugin>
             ....
             ....
        </plugins>
    </pluginManagement>
</build>



回答3:


You can add like this :

<executionManger><execution>...<execution/><executionManger/>

it will be working



来源:https://stackoverflow.com/questions/14514599/how-to-use-aspectj-maven-plugin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!