title: maven aspectj weaving NullPointerException
body: <p>I have a Spring MVC application made with MyEclipse, which contains generated sources as well as my own sources, plus aspects that I defined on the generated classes. Everything compiled fine in MyEclipse, but I want now to switch to Maven in order to use a continuous integration server.</p>
  
  <p>I have been fiddling with the pom.xml for a long while now, and I hit a wall I can't seem to get around. When maven gets to the moment of weaving aspects, I get the following exception (just the first few lines for brevity):</p>
  
  <pre><code>[INFO] [aspectj:compile {execution: default}]
  [INFO] Showing AJC message detail for messages of types: [error, warning, fail]
  [ERROR] ABORT
  May 30, 2016 11:48:05 AM org.aspectj.weaver.tools.Jdk14Trace info
  INFO: Dumping to /var/atlassian/application-data/bamboo/xml-data/build-dir/OW-BUIL-JOB1/./ajcore.20160530.114805.876.txt
  [INFO] ------------------------------------------------------------------------
  [ERROR] BUILD ERROR
  [INFO] ------------------------------------------------------------------------
  [INFO] AJC compiler errors:
  abort ABORT -- (NullPointerException) null
  null
  java.lang.NullPointerException
      at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor.resolveAnnotations(AnnotationDiscoveryVisitor.java:238)
      at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor.visit(AnnotationDiscoveryVisitor.java:217)
      at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1348)
      at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:748)
      ...
  </code></pre>
  
  <p>My pom.xml is too long to paste it here, but the build part is as follows (let me know if you want to see some of the dependencies):</p>
  
  <pre><code>&lt;build&gt;
      &lt;directory&gt;bin&lt;/directory&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.7&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;add-source&lt;/id&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;add-source&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;sources&gt;
                              &lt;source&gt;src&lt;/source&gt;
                              &lt;source&gt;generated&lt;/source&gt;
                              &lt;source&gt;resources&lt;/source&gt;
                          &lt;/sources&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
                  &lt;excludes&gt;
                      &lt;exclude&gt;main/&lt;/exclude&gt;
                      &lt;exclude&gt;test/&lt;/exclude&gt;
                  &lt;/excludes&gt;
                  &lt;useIncrementalCompilation&gt;true&lt;/useIncrementalCompilation&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.8&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
                  &lt;Xlint&gt;ignore&lt;/Xlint&gt;
                  &lt;complianceLevel&gt;1.6&lt;/complianceLevel&gt;
                  &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                  &lt;verbose&gt;true&lt;/verbose&gt;
                  &lt;aspectLibraries&gt;
                      &lt;aspectLibrary&gt;
                          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                          &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
                      &lt;/aspectLibrary&gt;
                  &lt;/aspectLibraries&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;process-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;compile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;webXml&gt;${project.basedir}/WebRoot/WEB-INF/web.xml&lt;/webXml&gt;
                  &lt;warName&gt;oligoWorld&lt;/warName&gt;
                  &lt;outputDirectory&gt;${project.basedir}&lt;/outputDirectory&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
      &lt;pluginManagement&gt;
          &lt;plugins&gt;
              &lt;!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.eclipse.m2e&lt;/groupId&gt;
                  &lt;artifactId&gt;lifecycle-mapping&lt;/artifactId&gt;
                  &lt;version&gt;1.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;lifecycleMappingMetadata&gt;
                          &lt;pluginExecutions&gt;
                              &lt;pluginExecution&gt;
                                  &lt;pluginExecutionFilter&gt;
                                      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                                      &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;
                                      &lt;versionRange&gt;[1.8,)&lt;/versionRange&gt;
                                      &lt;goals&gt;
                                          &lt;goal&gt;compile&lt;/goal&gt;
                                      &lt;/goals&gt;
                                  &lt;/pluginExecutionFilter&gt;
                                  &lt;action&gt;
                                      &lt;execute /&gt;
                                  &lt;/action&gt;
                              &lt;/pluginExecution&gt;
                          &lt;/pluginExecutions&gt;
                      &lt;/lifecycleMappingMetadata&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>Anybody seeing anything wrong or missing that might cause that exception? FYI, the version of my aspectj dependencies (aspectjrt, aspectjtools and aspectjweaver) is 1.8.7.</p>