Note that there are some explanatory texts on larger screens.

plurals
  1. POHow best to store Subversion version information in EAR's?
    text
    copied!<p>When receiving a bug report or an it-doesnt-work message one of my initials questions is always what version? With a different builds being at many stages of testing, planning and deploying this is often a non-trivial question.</p> <p>I the case of releasing Java JAR (ear, jar, rar, war) files I would like to be able to look in/at the JAR and switch to the same branch, version or tag that was the source of the released JAR.</p> <p>How can I best adjust the ant build process so that the version information in the svn checkout remains in the created build?</p> <p>I was thinking along the lines of:</p> <ul> <li>adding a VERSION file, but with what content?</li> <li>storing information in the META-INF file, but under what property with which content?</li> <li>copying sources into the result archive</li> <li>added svn:properties to all sources with keywords in places the compiler leaves them be</li> </ul> <hr> <p>I ended up using the svnversion approach (the accepted anwser), because it scans the entire subtree as opposed to svn info which just looks at the current file / directory. For this I defined the SVN task in the ant file to make it more portable. </p> <pre><code>&lt;taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"&gt; &lt;classpath&gt; &lt;pathelement location="${dir.lib}/ant/svnant.jar"/&gt; &lt;pathelement location="${dir.lib}/ant/svnClientAdapter.jar"/&gt; &lt;pathelement location="${dir.lib}/ant/svnkit.jar"/&gt; &lt;pathelement location="${dir.lib}/ant/svnjavahl.jar"/&gt; &lt;/classpath&gt; &lt;/taskdef&gt; </code></pre> <p>Not all builds result in webservices. The ear file before deployment must remain the same name because of updating in the application server. Making the file executable is still an option, but until then I just include a version information file.</p> <pre><code>&lt;target name="version"&gt; &lt;svn&gt;&lt;wcVersion path="${dir.source}"/&gt;&lt;/svn&gt; &lt;echo file="${dir.build}/VERSION"&gt;${revision.range}&lt;/echo&gt; &lt;/target&gt; </code></pre> <p>Refs:<br> svnrevision: <a href="http://svnbook.red-bean.com/en/1.1/re57.html" rel="noreferrer">http://svnbook.red-bean.com/en/1.1/re57.html</a><br> svn info <a href="http://svnbook.red-bean.com/en/1.1/re13.html" rel="noreferrer">http://svnbook.red-bean.com/en/1.1/re13.html</a><br> subclipse svn task: <a href="http://subclipse.tigris.org/svnant/svn.html" rel="noreferrer">http://subclipse.tigris.org/svnant/svn.html</a><br> svn client: <a href="http://svnkit.com/" rel="noreferrer">http://svnkit.com/</a></p>
 

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