aspectj not recognized in Maven plugin

自作多情 提交于 2021-01-28 12:42:15

问题


I'm looking at the "spring-mvc-showcase" project-- an example on Spring dashboard. it is one on Github-- now downloaded on my disk.

i'm getting the following error:

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

to this tag in the pom.xml file.

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <!-- Have to use version 1.2 since version 1.3 does not appear to work with ITDs -->
            <version>1.2</version>
                ....
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>
                    </goals>
                </execution>

                ....

No other error anywhere else in the package-- except for some warnings to unused APIs imported.

is this a version problem, something wrong w/my Maven installation...? im running the latest version of Maven.

This is a request for a quick fix. not good with Maven, new to the whole MVC framework and a warn out already.


回答1:


M2E doesn't provide life cycle mapping for aspectj plugin. Here is how I had configured aspjectj

<pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>aspectj-maven-plugin</artifactId>
                                        <versionRange>[1.0,)</versionRange>
                                        <goals>
                                            <goal>test-compile</goal>
                                            <goal>compile</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>






<!-- Aspectj compiler -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId> 
                <version>1.4</version> 
                <executions> 
                    <execution> 
                        <goals>
                            <goal>compile</goal> 
                        </goals> 
                        <configuration> 
                            <source>1.6</source> 
                            <target>1.6</target> 
                        </configuration> 
                    </execution> 
                </executions> 
            </plugin>



回答2:


I had the same problem, but it was due to a missing aspectjweaver maven dependency. You can get its details here.

I used the latest version, v1.8.4 for Eclipse Luna 4.4.1 and the errors went away.



来源:https://stackoverflow.com/questions/19614724/aspectj-not-recognized-in-maven-plugin

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