【问题标题】:Error in Eclipse Luna in m2e plugin when adding dependency to AspectJ将依赖项添加到 AspectJ 时,m​​2e 插件中的 Eclipse Luna 出错
【发布时间】:2014-10-04 07:20:07
【问题描述】:

我正在尝试在我的项目中使用 AspectJ。当我尝试在我的 pom.xml 中添加 maven 插件 aspectj-maven-plugin 时,我收到此错误:

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

我已经尝试安装 AspectJ 工具包 + AspectJ m2e 连接器,但是每次注解都会出错,因为编译级别似乎不是 1.5 或更高。

我的设置是:Eclipse Luna + Java EE7 + JDK8。

我的 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.dickschmeck</groupId>
<artifactId>housekeepingbook-web</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>Web Project</name>
<description>Web Project</description>

<properties>
    <junit.version>4.11</junit.version>
    <log4j.version>2.0.2</log4j.version>
    <primefaces.version>4.0</primefaces.version>
</properties>

<dependencies>
    <!-- Java EE 7 dependency -->
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

    <!-- JSR-330 -->
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <!-- JSF -->
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.5</version>
        <scope>provided</scope>

    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.5</version>
        <scope>provided</scope>

    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <!-- Primefaces -->
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.0</version>
    </dependency>
    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>all-themes</artifactId>
        <version>1.0.10</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.2.Final</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.2.Final</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.0.2.GA</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <!-- log4j -->
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${log4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.3.2</version>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.8.2</version>
    </dependency>

</dependencies>
<repositories>
    <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
    </repository>
</repositories>
<build>

    <plugins>
        <!-- Avoid war plugin complaining missing web.xml -->
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </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.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.7</version>
        <configuration>
            <complianceLevel>1.8</complianceLevel>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
        <executions>
            <execution>
                <goals>
                    <goal>compile</goal>
                    <goal>test-compile</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.0.0.Final</version>
            <configuration>
                <hostname>${wildfly-hostname}</hostname>
                <port>${wildfly-port}</port>
                <username>${wildfly-username}</username>
                <password>${wildfly-password}</password>
            </configuration>
        </plugin>

    </plugins>

</build>

提前非常感谢您的回答!

【问题讨论】:

    标签: eclipse maven aspectj


    【解决方案1】:

    这更多是 m2e 插件的问题或怪癖,与 aspectj 无关 - 这也是它在 @kriegaex 的 IntelliJ IDEA 中工作的原因。

    这是解释原因的 Eclipse-Wiki 的相关站点:http://wiki.eclipse.org/M2E_plugin_execution_not_covered

    This question 是同样的问题,一种可能的解决方案似乎是添加相应的&lt;pluginManagement&gt;-tag,如最高投票答案中所述。

    还请记住,此错误仅与 在 Eclipse 中构建应用程序有关。它与 maven 构建无关,如果您只通过 maven 构建项目,则可以安全地忽略它 - Eclipse 建议的错误快速修复应该提供忽略错误的选项。

    【讨论】:

      【解决方案2】:

      我不完全理解您的问题,但如果我告诉您,为了获得 Luna 的 AJDT(AspectJ 开发工具)版本,目前您需要使用可从以下获得的快照/开发人员版本,这可能会有所帮助

      http://download.eclipse.org/tools/ajdt/44/dev/update/

      这样的 POM 似乎没问题,至少它适用于 IntelliJ IDEA 中的空项目或 Maven 命令行。

      【讨论】:

        猜你喜欢
        • 2012-11-28
        • 2015-11-19
        • 2014-09-19
        • 1970-01-01
        • 2012-01-20
        • 1970-01-01
        • 2013-05-16
        • 2011-06-25
        • 2020-01-09
        相关资源
        最近更新 更多