Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After more Googling, I came up with this (in the pom.xml):</p> <pre><code>&lt;plugins&gt; ... &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt; &lt;version&gt;1.3&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;run&lt;/goal&gt; &lt;/goals&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;configuration&gt; &lt;tasks&gt; &lt;property name="src.dir" value="${project.build.sourceDirectory}" /&gt; &lt;property name="package.dir" value="com/foo/bar" /&gt; &lt;property name="package.name" value="com.foo.bar" /&gt; &lt;property name="buildtime" value="${maven.build.timestamp}" /&gt; &lt;echo file="${src.dir}/${package.dir}/Version.java" message="package ${package.name};${line.separator}" /&gt; &lt;echo file="${src.dir}/${package.dir}/Version.java" append="true" message="public final class Version {${line.separator}" /&gt; &lt;echo file="${src.dir}/${package.dir}/Version.java" append="true" message=" public static String VERSION=&amp;quot;${buildtime}&amp;quot;;${line.separator}" /&gt; &lt;echo file="${src.dir}/${package.dir}/Version.java" append="true" message="}${line.separator}" /&gt; &lt;echo message="BUILD ${buildtime}" /&gt; &lt;/tasks&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; ... &lt;/plugins&gt; </code></pre> <p>It seems to work well and produces this Java file:</p> <pre><code>package com.foo.bar; public final class Version { public static String VERSION="100318.1211"; } </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