Skip to content

Commit

Permalink
Add SCM revision number (= git commit hash) and branch name (but the
Browse files Browse the repository at this point in the history
build-number plugin doesn't get that from git yet).
  • Loading branch information
mwoodiupui committed May 17, 2013
1 parent 163060c commit 879856b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
16 changes: 16 additions & 0 deletions dspace-api/pom.xml
Expand Up @@ -30,13 +30,15 @@
<directory>src/main/resources</directory>
<includes>
<include>maven.properties</include>
<include>scm.properties</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>maven.properties</exclude>
<exclude>scm.properties</exclude>
</excludes>
<filtering>false</filtering>
</resource>
Expand Down Expand Up @@ -207,6 +209,20 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
14 changes: 12 additions & 2 deletions dspace-api/src/main/java/org/dspace/app/util/Version.java
Expand Up @@ -25,12 +25,24 @@ public class Version
public static void main(String[] argv)
throws IOException
{
InputStream propStream;

Properties sys = System.getProperties();

// DSpace version
System.out.printf("DSpace version: %s\n",
Util.getSourceVersion());

// SCM revision
Properties scm = new Properties();
propStream = Version.class.getResourceAsStream("/scm.properties");
if (null != propStream)
{
scm.load(propStream);
}
System.out.printf(" SCM revision: %s\n", scm.get("revision"));
System.out.printf(" SCM branch: %s\n", scm.get("branch"));

// OS version
System.out.printf(" OS: %s(%s) version %s\n",
sys.get("os.name"),
Expand All @@ -57,8 +69,6 @@ public static void main(String[] argv)
sys.get("java.vendor"),
sys.get("java.version"));

InputStream propStream;

// ant version
Properties ant = new Properties();
propStream = Version.class.getResourceAsStream("/ant.properties");
Expand Down

0 comments on commit 879856b

Please sign in to comment.