title: Maven: set property in pom.xml from properties file
body: <p>I have multi-module project with a lot of dependencies on different modules versions. At the moment versions are hardcoded and one needs to change them manually. So I decided to put all of them to a properties file and get properties values from it during project build.</p>
  
  <p>Here is how I try to do it:</p>
  
  <p><strong>root pom.xml</strong></p>
  
  <pre><code>&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;
  </code></pre>
  
  <p><strong>file version.properties</strong></p>
  
  <pre><code>module1.version=1.1
  module2.version=1.8
  module3.version=5.4
  </code></pre>
  
  <p><strong>example of module pom.xml</strong></p>
  
  <pre><code>&lt;properties&gt;
      &lt;module1.project.version&gt;${module1.version}&lt;/module1.project.version&gt;
  &lt;/properties&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;com.mymodule&lt;/groupId&gt;
      &lt;artifactId&gt;test&lt;/artifactId&gt;
      &lt;version&gt;${module1.version}&lt;/version&gt;
      &lt;relativePath&gt;../pom.xml&lt;/relativePath&gt;
  &lt;/parent&gt;
  </code></pre>
  
  <p>Build fails with:</p>
  
  <blockquote>
    <p>Failed to execute goal
    org.codehaus.mojo:build-helper-maven-plugin:1.7:parse-version
    (parse-versions) on project ccm-agent: Execution parse-versions of
    goal org.codehaus.mojo:build-helper-maven-plugin:1.7:parse-version
    failed. NullPointerException -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
    execute goal
    org.codehaus.mojo:build-helper-maven-plugin:1.7:parse-version
    (parse-versions) on project ccm-agent: Execution parse-versions of
    goal org.codehaus.mojo:build-helper-maven-plugin:1.7:parse-version
    failed.</p>
  </blockquote>
  
  <p>How can I read some properties from a file and configure pom.xml in correct way?</p>