]> juplo.de Git - website/blob
fd5383c5d9e3fff2b02855ac92028240cc61c097
[website] /
1 ---
2 _edit_last: "2"
3 author: kai
4 categories:
5   - java
6   - maven
7 date: "2014-07-18T10:36:19+00:00"
8 guid: http://juplo.de/?p=306
9 parent_post_id: null
10 post_id: "306"
11 title: Running aspectj-maven-plugin with the current Version 1.8.1 of AspectJ
12 url: /running-aspectj-maven-plugin-with-the-current-version-1-8-1-of-aspectj/
13
14 ---
15 Lately, I stumbled over a syntactically valid class, that [can not be compiled by the aspectj-maven-plugin](/aspectj-maven-plugin-can-not-compile-valid-java-7-0-code/ "Read more about the code, that triggers the AspectJ compilation error"), even so it is a valid Java-7.0 class.
16
17 Using the current version ( [Version 1.8.1](http://search.maven.org/#artifactdetails|org.aspectj|aspectjtools|1.8.1|jar "See informations about the current version 1.8.1 of AspectJ on Maven Central")) of [AspectJ](http://www.eclipse.org/aspectj/ "Visit the homepage of the AspectJ-project") solves this issue.
18 But unfortunatly, there is no new version of the [aspectj-maven-plugin](http://mojo.codehaus.org/aspectj-maven-plugin/ "Learn more about the aspectj-maven-plugin") available, that uses this new version of AspectJ.
19 [The last version of the aspectj-maven-plugin](http://search.maven.org/#artifactdetails|org.codehaus.mojo|aspectj-maven-plugin|1.6|maven-plugin "Read more informations about the latest version of the aspectj-maven-plugin on Maven Central") was released to Maven Central on December the 4th 2013 and this versions is bundeled with the version 1.7.2 of AspectJ.
20
21 The simple solution is, to bring the aspectj-maven-plugin to use the current version of AspectJ.
22 This can be done, by overwriting its dependency to the bundled aspectj.
23 This definition of the plugin does the trick:
24
25 ```xml
26
27 <plugin>
28   <groupId>org.codehaus.mojo</groupId>
29   <artifactId>aspectj-maven-plugin</artifactId>
30   <version>1.6</version>
31   <configuration>
32     <complianceLevel>1.7</complianceLevel>
33     <aspectLibraries>
34       <aspectLibrary>
35         <groupId>org.springframework</groupId>
36         <artifactId>spring-aspects</artifactId>
37       </aspectLibrary>
38     </aspectLibraries>
39   </configuration>
40   <executions>
41     <execution>
42       <goals>
43         <goal>compile</goal>
44       </goals>
45     </execution>
46   </executions>
47   <dependencies>
48     <dependency>
49       <groupId>org.aspectj</groupId>
50       <artifactId>aspectjtools</artifactId>
51       <version>1.8.1</version>
52     </dependency>
53   </dependencies>
54 </plugin>
55
56 ```
57
58 The crucial part is the explicit dependency, the rest depends on your project and might have to be adjusted accordingly:
59
60 ```xml
61
62   <dependencies>
63     <dependency>
64       <groupId>org.aspectj</groupId>
65       <artifactId>aspectjtools</artifactId>
66       <version>1.8.1</version>
67     </dependency>
68   </dependencies>
69
70 ```
71
72 I hope, that helps, folks!