7 date: "2014-07-18T10:32:21+00:00"
8 guid: http://juplo.de/?p=302
11 title: aspectj-maven-plugin can not compile valid Java-7.0-Code
12 url: /aspectj-maven-plugin-can-not-compile-valid-java-7-0-code/
15 I stumbled over a valid construction, that can not be compiled by the [aspectj-maven-plugin](http://mojo.codehaus.org/aspectj-maven-plugin/ "Jump to the homepage of the aspectj-maven-plugin"):
21 void outer(Inner inner)
38 This code might look very useless.
39 Originally, it `Inner` was a Thread, that wants to signal its enclosing class, that it has finished some work.
40 I just striped down all other code, that was not needed, to trigger the error.
42 If you put the class `Outer` in a maven-project and configure the aspectj-maven-plugin to weave this class with compliance-level 1.6, you will get the following error:
46 [ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.6:compile (default-cli) on project shouter: Compiler errors:
47 [ERROR] error at outer.inner(this);
49 [ERROR] /home/kai/juplo/shouter/src/main/java/Outer.java:16:0::0 The method inner(Outer.Inner) is undefined for the type Outer
50 [ERROR] error at queue.done(this, System.currentTimeMillis() - start);
55 The normal compilation works, because the class is syntactically correct Java-7.0-Code.
56 But the AspectJ-Compiler (Version 1.7.4) bundeled with the aspectj-maven-pluign will fail!
58 Fortunately, I found out, [how to use the aspectj-maven-plugin with AspectJ 1.8.3](/running-aspectj-maven-plugin-with-the-current-version-1-8-1-of-aspectj/ "Read, how to run the aspectj-maven-plugin with a current version of AspectJ").
60 So, if you have a similar problem, [read on...](/running-aspectj-maven-plugin-with-the-current-version-1-8-1-of-aspectj/ "Read, how you can solve this ajc compilation error")