2014-10-04 47 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命令行中的空白项目上工作。