java 如何使用aspectj-maven-plugin

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14514599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 16:30:58  来源:igfitidea点击:

How to use aspectj-maven-plugin

javamavenaspectj

提问by cloud

I'm a newbie to AspectJ and Maven.

我是 AspectJ 和 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 2ndEdition.

我正在尝试使用 aspectj-maven-plugin 来构建我的项目,但它不起作用。我只是按照AspectJ In Action 2 ndEdition 中的步骤操作

<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:

这是我在线时收到的错误消息<execution>

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

生命周期配置未涵盖的插件执行:org.codehaus.mojo:aspectj-maven-plugin:1.4:compile(执行:默认,阶段:编译)

I'm using JDK6 and Apache Maven 3.0.4.

我使用的是 JDK6 和 Apache Maven 3.0.4。

回答by Andrew Eisenberg

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

您需要安装 AspectJ Maven 配置器。它可以在这里找到:

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

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

Help -> Install new software...

帮助 -> 安装新软件...

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

将此更新站点添加到“使用”部分并选择该功能。

回答by Shishir Kumar

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.

要使用 aspectj-maven-plugin 解决此插件执行问题,您可以将您的 标记为 在你的 pom.xml 中标记。这将删除 eclipse 中的异常。

Shown as below:

如下图所示:

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

回答by for_mxq

You can add like this :

你可以这样添加:

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

it will be working

它会工作