title: AspectJ module dependency with Maven - How get working the Inter-type declarations methods of a dependency module
body: <p><strong>This is my situation:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/VSwzOl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VSwzOl.png" alt="Workspace-my-project-aj-dependency"></a></p>
  
  <p>I have a maven project <code>my-project-aj-dependency</code> composed by two jar modules:</p>
  
  <ul>
  <li><code>my-project-aj-dependencyJarWithAJ</code> (where I have an <a href="https://eclipse.org/aspectj/doc/released/progguide/language-interType.html" rel="nofollow noreferrer">Inter-type declaration</a>, see the <code>ahah()</code> method below inside the aspect <code>AppWithAj_Ahah.aj</code>)</li>
  <li><code>my-project-aj-dependencyJarWithoutAJ</code></li>
  </ul>
  
  <p><strong><em>My problem is that I would like to use some declared method defined in the aspect of the first module inside the second module, but probably I missed something.</em></strong></p>
  
  <p><strong>My poms configuration is the following:</strong></p>
  
  <p>Maven project pom (<code>my-project-aj-dependency</code>):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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/maven-v4_0_0.xsd"&gt;
      &lt;name&gt;MyProjectAjDependency&lt;/name&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.madx&lt;/groupId&gt;
      &lt;artifactId&gt;my-project-aj-dependency&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;modules&gt;
          &lt;!-- &lt;module&gt;TestMaven-ejb&lt;/module&gt; --&gt;
          &lt;module&gt;my-project-aj-dependencyJarWithAJ&lt;/module&gt;
          &lt;module&gt;my-project-aj-dependencyJarWithoutAJ&lt;/module&gt;
      &lt;/modules&gt;
  
      &lt;properties&gt;
          &lt;maven.compiler.target&gt;1.7&lt;/maven.compiler.target&gt;
          &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt;
          &lt;aspectj.version&gt;1.8.9&lt;/aspectj.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.madx&lt;/groupId&gt;
                  &lt;artifactId&gt;my-project-aj-dependencyJarWithAj&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.madx&lt;/groupId&gt;
                  &lt;artifactId&gt;my-project-aj-dependencyJarWithoutAj&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Maven module 1 pom (<code>my-project-aj-dependencyJarWithAJ</code>):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;parent&gt;
        &lt;groupId&gt;com.madx&lt;/groupId&gt;
        &lt;artifactId&gt;my-project-aj-dependency&lt;/artifactId&gt;
        &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;/parent&gt;
     &lt;groupId&gt;com.madx&lt;/groupId&gt;
     &lt;artifactId&gt;my-project-aj-dependencyJarWithAJ&lt;/artifactId&gt;
     &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;name&gt;my-project-aj-dependencyJarWithAJ&lt;/name&gt;
     &lt;url&gt;http://maven.apache.org&lt;/url&gt;
     &lt;properties&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
     &lt;/properties&gt;
     &lt;dependencies&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
           &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
           &lt;version&gt;1.8.9&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;configuration&gt;
                 &lt;source&gt;${java-version}&lt;/source&gt;
                 &lt;target&gt;${java-version}&lt;/target&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
           &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                 &lt;execution&gt;
                    &lt;id&gt;install&lt;/id&gt;
                    &lt;phase&gt;install&lt;/phase&gt;
                    &lt;goals&gt;
                       &lt;goal&gt;sources&lt;/goal&gt;
                    &lt;/goals&gt;
                 &lt;/execution&gt;
              &lt;/executions&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.2&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;goal&gt;test-compile&lt;/goal&gt;
                    &lt;/goals&gt;
                 &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                 &lt;outxml&gt;true&lt;/outxml&gt;
                 &lt;source&gt;${java-version}&lt;/source&gt;
                 &lt;target&gt;${java-version}&lt;/target&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
        &lt;/plugins&gt;
     &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Maven module 2 pom (<code>my-project-aj-dependencyJarWithoutAJ</code>):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;parent&gt;
        &lt;groupId&gt;com.madx&lt;/groupId&gt;
        &lt;artifactId&gt;my-project-aj-dependency&lt;/artifactId&gt;
        &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;/parent&gt;
     &lt;groupId&gt;com.madx&lt;/groupId&gt;
     &lt;artifactId&gt;my-project-aj-dependencyJarWithoutAJ&lt;/artifactId&gt;
     &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;name&gt;my-project-aj-dependencyJarWithoutAJ&lt;/name&gt;
     &lt;url&gt;http://maven.apache.org&lt;/url&gt;
     &lt;properties&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
     &lt;/properties&gt;
     &lt;dependencies&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;com.madx&lt;/groupId&gt;
           &lt;artifactId&gt;my-project-aj-dependencyJarWithAj&lt;/artifactId&gt;
           &lt;version&gt;${project.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;configuration&gt;
                 &lt;source&gt;${java-version}&lt;/source&gt;
                 &lt;target&gt;${java-version}&lt;/target&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
           &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                 &lt;execution&gt;
                    &lt;id&gt;install&lt;/id&gt;
                    &lt;phase&gt;install&lt;/phase&gt;
                    &lt;goals&gt;
                       &lt;goal&gt;sources&lt;/goal&gt;
                    &lt;/goals&gt;
                 &lt;/execution&gt;
              &lt;/executions&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.2&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;goal&gt;test-compile&lt;/goal&gt;
                    &lt;/goals&gt;
                 &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                 &lt;outxml&gt;true&lt;/outxml&gt;
                 &lt;source&gt;${java-version}&lt;/source&gt;
                 &lt;target&gt;${java-version}&lt;/target&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
        &lt;/plugins&gt;
     &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Where <code>AppWithAj.java</code> is:</p>
  
  <pre><code>package org.my.project.aj.dependencyJarWithAJ;
  
  public class AppWithAj {
      public static void main( String[] args ){
          System.out.println( "Hello World!" );
      }
  }
  </code></pre>
  
  <p>and <code>AppWithAj_Ahah.aj</code> is:</p>
  
  <pre><code>package org.my.project.aj.dependencyJarWithAJ;
  
  public aspect AppWithAj_Ahah {
      public String AppWithAj.ahah(){
          return "Ahahahah!";
      }
  }
  </code></pre>
  
  <p>and finally <code>App.java</code> is:</p>
  
  <pre><code>package org.my.project.aj.dependencyJarWithoutAJ;
  import org.my.project.aj.dependencyJarWithAJ.AppWithAj;
  
  public class App {
      public static void main( String[] args ) {
          System.out.println( "Hello World! " + new AppWithAj().ahah());
      }
  }
  </code></pre>