<p>I'm trying to use maven2 to build an axis2 project.  My project is configured as a parent project with AAR, WAR, and EAR modules.  When I run the parent project's package goal, the console shows a successful build and all of the files are created.  However the AAR file generated by AAR project is not included in the generated WAR project.  The AAR project is listed as a dependency of WAR project.  When I explicitly run the WAR's package goal, the AAR file is then included in the WAR file.</p>

<p>Why would the parent's package goal not include the necessary dependency while running the child's package goal does?</p>

<p>I'm using the maven-war-plugin v2.1-alpha-2 in my war project.</p>

<p>Parent POM:</p>

<pre><code>&lt;parent&gt;
    &lt;groupId&gt;companyId&lt;/groupId&gt;
    &lt;artifactId&gt;build&lt;/artifactId&gt;
    &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;/parent&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;com.nationwide.nf&lt;/groupId&gt;
&lt;artifactId&gt;parent&lt;/artifactId&gt;
&lt;packaging&gt;pom&lt;/packaging&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;modules&gt;
    &lt;module&gt;ws-war&lt;/module&gt;
    &lt;module&gt;ws-aar&lt;/module&gt;
    &lt;module&gt;ws-ear&lt;/module&gt;
&lt;/modules&gt;
</code></pre>

<p>AAR POM:</p>

<pre><code>&lt;parent&gt;
    &lt;artifactId&gt;parent&lt;/artifactId&gt;
    &lt;groupId&gt;companyId&lt;/groupId&gt;
    &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;/parent&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;companyId&lt;/groupId&gt;
&lt;artifactId&gt;ws-aar&lt;/artifactId&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;description/&gt;
&lt;packaging&gt;aar&lt;/packaging&gt;
&lt;dependencies&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;1.5&lt;/source&gt;
                &lt;target&gt;1.5&lt;/target&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt; 

        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
            &lt;artifactId&gt;axis2-wsdl2code-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.4&lt;/version&gt;
            &lt;configuration&gt;...&lt;/configuration&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;wsdl2code&lt;/goal&gt;
                    &lt;/goals&gt;
                    &lt;id&gt;axis2-gen-sources&lt;/id&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
            &lt;artifactId&gt;axis2-aar-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.4&lt;/version&gt;
            &lt;extensions&gt;true&lt;/extensions&gt;
            &lt;configuration&gt;...&lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>

<p>WAR POM:</p>

<pre><code>&lt;parent&gt;
    &lt;artifactId&gt;parent&lt;/artifactId&gt;
    &lt;groupId&gt;companyId&lt;/groupId&gt;
    &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;/parent&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;companyId&lt;/groupId&gt;
&lt;artifactId&gt;ws-war&lt;/artifactId&gt;
&lt;packaging&gt;war&lt;/packaging&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;description/&gt;
&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;companyId&lt;/groupId&gt;
        &lt;artifactId&gt;ws-aar&lt;/artifactId&gt;
        &lt;type&gt;aar&lt;/type&gt;
        &lt;version&gt;1.0.0-SNAPSHOT&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-war-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.1-alpha-2&lt;/version&gt;
            &lt;configuration&gt;
                &lt;warName&gt;appName&lt;/warName&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>

<p>Thanks,
Joe</p>

[{'answer_id': 89868, 'author': 'user11087', 'author_id': 11087, 'author_profile': 'https://Stackoverflow.com/users/11087', 'pm_score': 0, 'selected': False, 'text': '<p>Have you tried using the "type" element in your dependencies?  For example:</p>\n\n<pre><code>&lt;dependency&gt;\n  &lt;groupId&gt;group-a&lt;/groupId&gt;\n  &lt;artifactId&gt;artifact-b&lt;/artifactId&gt;\n  &lt;version&gt;1.0&lt;/version&gt;\n  &lt;type&gt;aar&lt;/type&gt;\n&lt;/dependency&gt;\n</code></pre>\n\n<p>Its hard to say for sure what your problem is without seeing your actual pom files.</p>\n\n<p>Update:</p>\n\n<p>What happens if, from the parent project, you run:</p>\n\n<pre><code> mvn clean install\n</code></pre>\n\n<ol>\n<li>Does "install" have any different behavior than "package" as far as your problem is concerned?</li>\n<li>Do you see the .aar file in your local maven repository (~/.m2/repository/com/mycompany/.../)?</li>\n</ol>\n\n<p>As a side note, i\'ve never been very happy with the maven war plugin.  I\'ve always ended up using the maven assembly plugin.  It just seems to work better and is more consistent.  Also, make sure you are using the latest version of maven (2.0.9).  I spent half a day fighting a similar problem which was fixed in the latest version.</p>\n'}, {'answer_id': 120938, 'author': 'Joe', 'author_id': 5313, 'author_profile': 'https://Stackoverflow.com/users/5313', 'pm_score': 3, 'selected': True, 'text': '<p>I was able to get my maven build working correctly by adding the following plugin to the ws-war pom file:</p>\n\n<pre><code>        &lt;plugin&gt;\n            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;\n            &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;\n            &lt;executions&gt;\n                &lt;execution&gt;\n                    &lt;phase&gt;process-classes&lt;/phase&gt;\n                    &lt;goals&gt;\n                        &lt;goal&gt;copy-dependencies&lt;/goal&gt;\n                    &lt;/goals&gt;\n                    &lt;configuration&gt;\n                        &lt;outputDirectory&gt;\n                            ${project.build.directory}/${project.build.finalName}/WEB-INF/services\n                        &lt;/outputDirectory&gt;\n                        &lt;includeArtifactIds&gt;\n                            ws-aar\n                        &lt;/includeArtifactIds&gt;\n                    &lt;/configuration&gt;\n                &lt;/execution&gt;\n            &lt;/executions&gt;\n        &lt;/plugin&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/73491', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5313/']