14
votes

I've just downloaded the OEPE (Kepler) and installed m2e and m2e-wtp connectors. I found out that under this path: Preferences ->Maven->Lifecycle mappings->Open workspace lifecycle mapping data there is a preconfigured xml file which says that maven should ignore the compile goal for AspectJ and I assume that's why the AspectJ runtime libraries are not added to the project hence the project is not recognized as an AspectJ project by eclipse.

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
    <pluginExecution>
        <pluginExecutionFilter>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <versionRange>1.6</versionRange>
            <goals>
                <goal>compile</goal>
            </goals>
        </pluginExecutionFilter>
        <action>
            <ignore />
        </action>
    </pluginExecution>
</pluginExecutions>

I commented out these lines in the xml file and reloaded it once again. Now the IDE does not ignore AspectJ plugin tag in the lifecycle but pom file is complaining that it cannot recognize the execution tag.

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>${aspectj.version}</version>
    </dependency>
</dependencies>
<configuration>
    <source>1.6</source>
    <target>1.6</target>
</configuration>
<executions>
    <execution>
        <goals>
            <goal>compile</goal>
        </goals>
    </execution>
</executions>
</plugin>

Using indigo the m2e-wtp was able to recognize the <execution> tag for aspectj plugin and able to add the AspectJ runtime libraries automatically to the project, though this is not the case in Kepler. (I think it is m2e-wtp's job to make an AspectJ project out of the pom but not quite sure.)

Btw. the how can I make things work like in Indigo? I know I can right click on the project and convert it to aspect project in order to solve the problem but I want the IDE and plugins realize from the pom file that this project needs AspectJ jars. Any idea?

1
just a reminder Don't use eclipse mars default links for ajdt plugins instead use above links. They perfectly works for mars alsofatih tekin

1 Answers

29
votes

This is how I got it working, first verify you have installed AJDT support by installing "AspectJ Development Tools (AJDT)" and "AspectJ compiler for Eclipse" from the AJDT update site: http://download.eclipse.org/tools/ajdt/43/update You can do this through the "Help / Install new software" menu item.

Then, install the M2E connector manually by installing AJDT M2E using this update site: http://dist.springsource.org/release/AJDT/configurator/