title: Modifying jar filename using maven
body: <p>I have a requirement that all the artifacts created by maven bear a build number.
  The build number is stored in a properties file. I'm successful with controlling the names of generated EAR and WAR artifacts but not the JAR. Here are the relevant excerpts from pom.xml.
  I expected the maven-jar-plugin configuration to work but it does not, I end up with jar always named <em>SelfService-2.jar</em>, whereas when <em>buildNumber.properties</em> contains <em>buildNumber=40</em>, maven generates <em>SelfService-2.40.war</em> and <em>SelfService-2.40.ear</em>.</p>
  
  <p>How do I get the build number into the jar name?
  Thanks in advance.</p>
  
  <pre><code>&lt;artifactId&gt;SelfService&lt;/artifactId&gt;
  &lt;name&gt;SelfService&lt;/name&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;2&lt;/version&gt;
  
  &lt;build&gt;
    &lt;finalName&gt;${project.artifactId}-${buildNumber}&lt;/finalName&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.3.2&lt;/version&gt;
          &lt;configuration&gt;
              &lt;finalName&gt;${project.artifactId}-${buildNumber}&lt;/finalName&gt;
          &lt;/configuration&gt;
        &lt;/plugin&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.2&lt;/version&gt;
          &lt;configuration&gt;
            &lt;finalName&gt;${project.artifactId}-${buildNumber}&lt;/finalName&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
        ....
  </code></pre>