Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can also use <a href="https://code.google.com/p/maven-replacer-plugin" rel="noreferrer"><code>maven-replacer-plugin</code></a> if you feel ant is a little bit ugly: The pom enrty might be:</p> <pre><code>&lt;project&gt; ... &lt;properties&gt; &lt;version.template.file&gt;src/main/java/com/stackoverflowVersion.java.template&lt;/version.template.file&gt; &lt;version.file&gt;src/main/java/com/stackoverflow/Version.java&lt;/version.file&gt; &lt;/properties&gt; ... &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;com.google.code.maven-replacer-plugin&lt;/groupId&gt; &lt;artifactId&gt;maven-replacer-plugin&lt;/artifactId&gt; &lt;version&gt;1.4.0&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;process-sources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;replace&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;file&gt;${version.template.file}&lt;/file&gt; &lt;outputFile&gt;${version.file}&lt;/outputFile&gt; &lt;replacements&gt; &lt;replacement&gt; &lt;token&gt;@buildnumber@&lt;/token&gt; &lt;value&gt;${svn.revision}&lt;/value&gt; &lt;/replacement&gt; &lt;replacement&gt; &lt;token&gt;@buildtime@&lt;/token&gt; &lt;value&gt;${maven.build.timestamp}&lt;/value&gt; &lt;/replacement&gt; &lt;replacement&gt; &lt;token&gt;@pomversion@&lt;/token&gt; &lt;value&gt;${project.version}&lt;/value&gt; &lt;/replacement&gt; &lt;/replacements&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; ... &lt;/project&gt; </code></pre> <p>The Version.java.template might be:</p> <pre><code>package com.stackoverflow; public final class Version { public static final String build_number="@buildnumber@"; public static final String build_time="@buildtime@"; public static final String pomversion="@pomversion@"; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload