2014-10-04 52 views
0

我想在我的項目中使用AspectJ。當我嘗試添加Maven插件AspectJ的Maven的插件在我的pom.xml中,我得到這個錯誤:添加依賴到AspectJ時在m2e插件的Eclipse Luna中的錯誤

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.7:compile (execution: default, phase: 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> 

非常感謝您提前爲您解答!

回答

0

這更多的是m2e插件的問題或怪癖,並沒有針對aspectj - 這也是它在@kriegaex的IntelliJ IDEA中工作的原因。

這裏是Eclipse的維基的相關網站解釋原因:http://wiki.eclipse.org/M2E_plugin_execution_not_covered

This question是差不多的問題,一個可能的解決方案似乎是在最高描述的投票答案補充相應<pluginManagement> - 標籤。

也請記住,此錯誤僅適用於Eclipse中應用程序的構建。它對Maven構建沒有任何影響,如果您只通過maven構建項目,可以安全地忽略它 - Eclipse提供的錯誤修復提示應該忽略錯誤。

0

我完全不明白你的問題,但也許它幫助,如果我告訴你,爲了得到月神的AJDT(AspectJ開發工具)的版本,目前您需要使用可用的快照/開發者版本從

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

這樣的POM似乎沒問題,至少它可以在IntelliJ IDEA或Maven命令行中的空白項目上工作。