0

I'm trying to use AspectJ in my project. When I try to add the maven plugin aspectj-maven-plugin in my pom.xml, I get this error:

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

I already tried to install the AspectJ toolkit + AspectJ m2e connector, but then I get an error at every annotation, because the compile level seems to be not 1.5 or above.

My setup is: Eclipse Luna + Java EE7 + JDK8.

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

Thank you very much in advance for your answers!

greg-449
  • 109,219
  • 232
  • 102
  • 145
Dennis G.
  • 73
  • 1
  • 1
  • 10

2 Answers2

0

I do not understand your problem exactly, but maybe it helps if I tell you that in order to get an AJDT (AspectJ Development Tools) version for Luna, currently you need to use a snapshot/developer version available from

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

The POM as such seems to be okay, at least it works on an empty project in IntelliJ IDEA or from the Maven command line.

kriegaex
  • 63,017
  • 15
  • 111
  • 202
0

That is more a problem or quirk of the m2e plugin and is nothing specific to aspectj - which is also the reason it works in @kriegaex 's IntelliJ IDEA.

Here's a relevant site of the Eclipse-Wiki explaining the cause: http://wiki.eclipse.org/M2E_plugin_execution_not_covered

This question is about the same problem and one possible solution appears to be to add a corresponding <pluginManagement>-tag as described in the highest voted answer.

Also keep in mind that this error only pertains to the build of your application in Eclipse. It has no bearing on the maven build and can be safely ignored if you only ever build your project via maven - the quick fixes suggested for the error by Eclipse should give the option to ignore the error.

Community
  • 1
  • 1
sheltem
  • 3,754
  • 1
  • 34
  • 39