title: AspectJ & Maven warning: "Advice defined in ... has not been applied?"
body: <p>I'm trying to weave some aspects at compile time into a project that becomes a WAR.  The aspects advise classes that are within the same project (though in different packages).</p>
  
  <p>I get the warning:</p>
  
  <pre><code>Advice not applied
  </code></pre>
  
  <p>My aspect is not being executed.  Here's my setup:</p>
  
  <p>annotation FooAnnotation.java:</p>
  
  <pre><code>package a;
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface FooAnnotation {}
  </code></pre>
  
  <p>aspect FooAdvice.aj:</p>
  
  <pre><code>package a;
  public aspect FooAdvice {
      private static final Log log = LogFactory.getLog(FooAdvice.class);
  
      Object around() : call( @FooAnnotation * *(..)) {   
          log.info(String.format("Testing around"));
          return proceed();
      }
  }
  </code></pre>
  
  <p>I also tried the annotation:</p>
  
  <pre><code>@Around("call( @FooAnnotation * *(..))")
  public Object checkFoo( ProceedingJoinPoint joinPoint) throws Throwable {
  </code></pre>
  
  <p>As far as I can tell, my pointcut specification is correct, but for some reason the ajc compiler isn't playing ball.</p>
  
  <p>Class FooClass.java:</p>
  
  <pre><code>package b;
  @ApplicationPath("/service")
  @Path("/{param}")
  @Produces("application/json")
  @Provider
  public class FooClass {
  
      @POST
      @PUT
      @Path("/{context}/{resource}")
      @FooAnnotation
      public String updateResource(...) {}
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;zzz.group&lt;/groupId&gt;
      &lt;artifactId&gt;yyy.artifact&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;name&gt;yyy.name&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;endorsed.dir&gt;${project.build.directory}/endorsed&lt;/endorsed.dir&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;javaVersion&gt;1.6&lt;/javaVersion&gt;
          &lt;org.aspectj-version&gt;1.7.2&lt;/org.aspectj-version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              ... stuff ...
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${javaVersion}&lt;/source&gt;
                      &lt;target&gt;${javaVersion}&lt;/target&gt;
                      &lt;compilerArguments&gt;
                          &lt;endorseddirs&gt;${endorsed.dir}&lt;/endorseddirs&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&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;version&gt;2.1.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&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;!--
                      Have to use version 1.2 since version 1.3 does not appear to work
                      with ITDs
                  --&gt;
                  &lt;version&gt;1.4&lt;/version&gt;
                  &lt;dependencies&gt;
                      &lt;!--
                          You must use Maven 2.0.9 or above or these are ignored (see
                          MNG-2972)
                      --&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
                          &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
                          &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
                          &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt;
                          &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;compile&lt;/goal&gt;
                              &lt;!-- &lt;goal&gt;test-compile&lt;/goal&gt; --&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;outxml&gt;true&lt;/outxml&gt;
                      &lt;source&gt;${javaVersion}&lt;/source&gt;
                      &lt;target&gt;${javaVersion}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>