Port 570487 to 1.0.x

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@588032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2007-10-24 21:18:28 +00:00
parent d4c2a2f77c
commit 18502c72ca
2 changed files with 19 additions and 18 deletions

View File

@ -45,8 +45,21 @@ public class OpenJPAVersion {
public static final String REVISION_NUMBER;
static {
Package pack = OpenJPAVersion.class.getPackage();
String vers = pack == null ? null : pack.getImplementationVersion();
Properties revisionProps = new Properties();
try {
InputStream in = OpenJPAVersion.class.getResourceAsStream
("/META-INF/org.apache.openjpa.revision.properties");
if (in != null) {
try {
revisionProps.load(in);
} finally {
in.close();
}
}
} catch (Exception e) {
}
String vers = revisionProps.getProperty("openjpa.version");
if (vers == null || "".equals(vers.trim()))
vers = "0.0.0";
VERSION_NUMBER = vers;
@ -71,21 +84,7 @@ public class OpenJPAVersion {
patch = 0;
}
String revision = "";
try {
InputStream in = OpenJPAVersion.class.getResourceAsStream
("/META-INF/org.apache.openjpa.revision.properties");
if (in != null) {
try {
Properties props = new Properties();
props.load(in);
revision = props.getProperty("revision.number");
} finally {
in.close();
}
}
} catch (Exception e) {
}
String revision = revisionProps.getProperty("revision.number");
MAJOR_RELEASE = major;
MINOR_RELEASE = minor;

View File

@ -157,9 +157,11 @@
<property name="subversion.revision"
value="unknown"/>
<echo>Revision: ${subversion.revision}</echo>
<echo>OpenJPA version: ${project.version}</echo>
<mkdir dir="${outdir}/META-INF"/>
<echo file="${outdir}/META-INF/org.apache.openjpa.revision.properties">revision.number=${subversion.revision}</echo>
<echo file="${outdir}/META-INF/org.apache.openjpa.revision.properties">revision.number=${subversion.revision}
openjpa.version=${project.version}</echo>
<delete dir="${tmpdir}"/>
</tasks>
</configuration>