I need to use aspectj in a maven project. I installed the maven plugin for eclipse (m2e), the maven aspectj plugin, and also AJDT for Eclipse. So now, when i open a new project i have "Maven Project" and "AspectJ Project". how can i make a new project that is Maven AspectJ project? I did not found any reference for that, so you are my only hope. thanks
6 Answers
- Go to Help > Install New Software...
- Use this software repository: http://dist.springsource.org/release/AJDT/configurator/
- Install the AJDT m2e Configurator
Source: http://blog.springsource.com/2011/10/18/upgrading-maven-integration-for-springsource-tool-suite-2-8-0/#comment-207264 (Andrew Eisenberg)

- 20,498
- 11
- 103
- 114
-
*Note*: there is a newer URL vor V2 of the connector. However, the old one works also in most of the cases I've seen... http://dist.springsource.org/release/AJDT/configurator-v2/ – Ichthyo Feb 26 '20 at 16:37
You should add the maven-aspectj-plugin to your build plugins section in your pom.xml as in:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<!-- use this goal to weave all your main classes -->
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<complianceLevel>1.6</complianceLevel>
</configuration>
</plugin>

- 2,263
- 18
- 24

- 6,184
- 1
- 34
- 31
-
[This answer](http://stackoverflow.com/questions/6844603/how-to-create-a-maven-project-in-eclipse-with-aspectj-support) is also of benefit. – KomodoDave Aug 24 '12 at 20:00
Check AJDT project configurator for m2eclipse
The m2eclipse-AJDT plugin detect that the pom.xml
contains the aspectj-maven-plugin
and add automatically the relevant AJDT
nature and configuration to the project when importing it in eclipse.
I think some effort have bean made for the plugin to work with version 0.12 of m2eclipse , dont know if it's worked.
I already try the plugin with m2eclipse 0.10 and it worked well.
See GitHub m2eclipse-ajdt project
See Move AJDT integration out of main m2e source tree

- 3,145
- 1
- 20
- 13
- Firstly we need to make sure AJDT (AspectJ development tools) is installed for eclipse. Check out the latest or appropriate version of AJDT for your Eclipse. (http://www.eclipse.org/ajdt/)
- Secondly install "AJDT m2e Configurator" using this repository http://dist.springsource.org/release/AJDT/configurator/ (As Hendy described above).
- If you have previously installed m2eclipse, you need to uninstall it before performing step 2.

- 2,817
- 2
- 21
- 27
-
It doesn't really work to me, neither installing AJDT before m2eclipse nor after it. I come up with this error: "The following plugin will not be installed" and instead it suggest me another 2 plugins. – another Sep 12 '16 at 08:48
If you have the aspectj-maven-plugin in your pom.xml you'll get one missing m2e connector :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11</version>
<configuration>
<includes>
<include>**/*aj</include>
<include>**/*java</include>
</includes>
<Xlint>ignore</Xlint>
<source>1.8</source>
<target>1.8</target>
<complianceLevel>1.8</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<weaveDependencies>
<weaveDependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<classifier>log4jonly</classifier>
</weaveDependency>
</weaveDependencies>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I had to install m2e AJDT maven plugin configurator in eclipse but it did not work at first because I had missing dependencies.
So to start install the AJDT tool available on this site : http://download.eclipse.org/tools/ajdt/48/dev/update/
Restart eclipse and then the install of m2e AJDT maven plugin configurator should work. After a new restart you should have eclipse available to build your aspectj classes.

- 2,131
- 2
- 21
- 35
You will have to add the relevant project facets to your project configuration in eclipse after adding the AspectJ support in your maven pom.xml
.

- 3,050
- 1
- 23
- 21