title: Maven: How can I get a profile to inherit the dependencyManagement tag from a parent pom?
body: <p>I run <a href="http://mojo.codehaus.org/jaxws-maven-plugin/wsgen-mojo.html" rel="nofollow">wsgen</a> in its own profile because I don't want it to run every time I build the product.  But I'm getting an error about a missing version when I run it:</p>
  
  <blockquote>
    <p>$ mvn package -P wsgen [INFO] Scanning for projects... [ERROR] The
    build could not read 1 project -> [Help 1] [ERROR] [ERROR]   The
    project project-ejb:2.3.15-SNAPSHOT
    (C:\Projects\MyProject\pom.xml) has 1 error
    [ERROR]<br>
    'build.plugins.plugin[org.jvnet.jax-ws-commons:jaxws-maven-plugin].dependencies.dependency.version'
    for org.glassfish:javax.javaee:jar is missing. @ line 167, column 41
    [ERROR] [ERROR] To see the full stack trace of the errors, re-run
    Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to
    enable full debug logging. [ERROR] [ERROR] For more information about
    the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1]
    <a href="http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException" rel="nofollow">http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException</a></p>
  </blockquote>
  
  <p>This is a snippet of the child pom (the pom with the profile):</p>
  
  <pre><code>&lt;packaging&gt;ejb&lt;/packaging&gt;
  &lt;parent&gt;
      &lt;artifactId&gt;MyProject&lt;/artifactId&gt;
      &lt;groupId&gt;project&lt;/groupId&gt;
      &lt;version&gt;2.3.15-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;wsgen&lt;/id&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.jvnet.jax-ws-commons&lt;/groupId&gt;
                          &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;2.1&lt;/version&gt;
                          &lt;executions&gt;
  ...
                  &lt;/executions&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.glassfish&lt;/groupId&gt;
                          &lt;artifactId&gt;javax.javaee&lt;/artifactId&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p></p>
  
  <p>But, in the parent pom I'm defining this dependency with its version under the <code>dependencyManagement</code> tag.  </p>
  
  <p>I think what's happening is the profile doesn't inherit the parent's <code>dependencyManagement</code> tag so it thinks that the dependency is missing a version number.  Is there a way to make the profile inherit this from the parent?  </p>