title: Maven3- How to tell maven to use latest versions using verions-maven-plugin?
body: <p>I am using Maven 3.2.5. I have a multi module project with parent P and sub-modules A(jar), B(war), C(EAR). I want to always use the latest version of dependency as we do nightly builds to QA environments. We could achieve this in Maven2 by using 'LATEST' in place of version number. But looks like this feature is disabled in MAVEN3. Now I am trying to make use of "use-latest-versions" goal in versions-maven-plugin. </p>
  
  <p>I am trying to run this plugin on modules B and C so that module B will use latest artifact from module A and module C will use latest artifact from module B to build final EAR.</p>
  
  <pre><code>    **My parent POM** 
          &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
          &lt;groupId&gt;GGGGGGG&lt;/groupId&gt;
          &lt;artifactId&gt;JARJARAJR&lt;/artifactId&gt;
          &lt;version&gt;19.1-SNAPSHOT&lt;/version&gt;
          &lt;packaging&gt;pom&lt;/packaging&gt;
  
          &lt;name&gt;JARJARAJR&lt;/name&gt;
  
  //Modules of this project
          &lt;modules&gt;
              &lt;module&gt;../../../Module A&lt;/module&gt;
              &lt;module&gt;../../../Module Bs&lt;/module&gt;
              &lt;module&gt;../../../Module C&lt;/module&gt;
          &lt;/modules&gt;
  
      &lt;build&gt;
              &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                      &lt;artifactId&gt;versions-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.1&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;update-dependency-versions&lt;/id&gt;
  //Asking maven to run this goal in 'pre-clean' phase
                              &lt;phase&gt;pre-clean&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;use-latest-versions&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                      &lt;configuration&gt;
                          &lt;allowSnapshots&gt;true&lt;/allowSnapshots&gt;
                          &lt;excludeReactor&gt;false&lt;/excludeReactor&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/pluginManagement&gt;
  
      The command I am using to run parent POM is : **mvn -U clean install -P devb -    Dmaven.test.skip=true**
  </code></pre>
  
  <p>I am trying to invoke "use-latest-versions" goal in the "pre-clean" phase(I tried validate and initialize phases too).Bu after module A is built, maven tried to resolve the old version of Module B without running goal "use-latest-versions" for 'versions-maven-plugin".</p>
  
  <p><strong>In which phase should I run "use-latest-versions" goal so that maven updates the dependency version in Module B before trying to build it?</strong></p>