title: How to set different version for all child in a multi module maven project setup
body: <p>We have multi module project setup with a lot of dependencies on different modules versions. </p>
  
  <pre><code>ParentModule_16.3.0.1.0-
     ----ChildModule1_16.3.0.1.0
     ----ChildModule2_16.3.0.1.0
     ----ChildModule3_16.3.0.1.0
  </code></pre>
  
  <p>Earlier all versions were hardcoded in pom.xml for each module. Later we decided to get these versions from a property file. So i followed below link and it worked fine -</p>
  
  <p><a href="https://stackoverflow.com/questions/18574025/maven-set-property-in-pom-xml-from-properties-file">Maven: set property in pom.xml from properties file</a></p>
  
  <p>now we have a scenario where we want to update version of
       <em>childmodule2_<strong>16.3.0.1.0</strong> to childModule2_<strong>16.6.0.0.0</strong> 
       and 
       parentModule_<strong>16.3.0.1.0</strong> to parentModule_<strong>16.6.0.0.0</em></strong> 
  and <em>rest remains unchanged</em>.</p>
  
  <p>Now the issue we are facing is, when we do full build using parent's pom it doesn't pick jars of some modules because of old versions(16.3.0.1.0).</p>
  
  <p>I have read some blogs where it says maven always pick latest versions.hence the older jars are not getting picked.and some says You always have to specify parent's version. Fortunately, it is inherited as the module's version what is desirable in most cases. Moreover, this parent's version declaration is bumped automatically by Maven Release Plugin.</p>
  
  <p>Can some please help me to understand this. Is there any way to solve this? Thanks in advance.</p>
  
  <p>Below is my Parent pom.xml</p>
  
  <hr>
  
  <pre><code>&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.myproject&lt;/groupId&gt;
  &lt;artifactId&gt;parent&lt;/artifactId&gt;
  &lt;version&gt;${parent-version}&lt;/version&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  
  &lt;modules&gt;
      &lt;module&gt;chiled1&lt;/module&gt;
      &lt;module&gt;child2&lt;/module&gt;
  &lt;/modules&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.0-alpha-2&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0-alpha-2&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;initialize&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;read-project-properties&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;files&gt;
                              &lt;file&gt;version.properties&lt;/file&gt;
                          &lt;/files&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.18.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;parallel&gt;methods&lt;/parallel&gt;
                  &lt;threadCount&gt;10&lt;/threadCount&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;!-- Make assembly --&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;descriptor&gt;${project.basedir}/assembly.xml&lt;/descriptor&gt;
                  &lt;outputDirectory&gt;${project.basedir}/dist&lt;/outputDirectory&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;create-archive&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <hr>
  
  <p>child2 pom.xml</p>
  
  <hr>
  
  <pre><code>&lt;groupId&gt;com.myproject.child1&lt;/groupId&gt;
  &lt;artifactId&gt;child2&lt;/artifactId&gt;
  &lt;version&gt;${child2-version}&lt;/version&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;${project.artifactId}-${version}&lt;/finalName&gt;
      &lt;plugins&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.0-alpha-2&lt;/version&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;phase&gt;initialize&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;read-project-properties&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                      &lt;files&gt;
                          &lt;file&gt;../version.properties&lt;/file&gt;
                      &lt;/files&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
  
      &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <hr>
  
  <p>version.properties</p>
  
  <hr>
  
  <p>Earlier -
  <li>parent-version=16.3.0.1.0
  <li>child1-version=16.3.0.1.0
  <li>child2-version=16.3.0.1.0</p>
  
  <p>Now-
  <li>parent-version=16.5.0.0.0
  <li>child1-version=16.3.0.1.0
  <li>child2-version=16.5.0.0.0</p>