Correct handling of Version.java

It is generated automatically from the version and the git hash.
This commit is contained in:
Diomidis Spinellis 2013-05-23 19:05:57 +03:00
parent f6e263028a
commit faedc3f0ff
3 changed files with 2 additions and 30 deletions

View File

@ -83,7 +83,7 @@
<arg value="HEAD"/>
</exec>
<echo>Version is ${VERSION}</echo>
<echo file="src/org/umlgraph/doclet/Version.java">/* Automatically generated file */
<echo file="src/main/java/org/umlgraph/doclet/Version.java">/* Automatically generated file */
package org.umlgraph.doclet;
class Version { public static String VERSION = "${VERSION}";}
</echo>

View File

@ -0,0 +1 @@
Version.java

View File

@ -1,29 +0,0 @@
package org.umlgraph.doclet;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
class Version {
private final static String filename = "version.properties";
private final static String key = "umlgraph.version";
public static String VERSION;
static {
Properties props = new Properties();
InputStream in = Version.class.getClassLoader().getResourceAsStream(filename);
try {
props.load(in);
if (props.get(key) == null) {
System.err.println("Could not find version property");
VERSION = "0";
} else {
VERSION = props.get(key).toString();
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}