From 42e4ea2c1db4be80455c13d6261e49d43f017632 Mon Sep 17 00:00:00 2001 From: kruthar <kruthar@gmail.com> Date: Thu, 3 Mar 2016 21:36:00 -0600 Subject: [PATCH] [core] added real version printout Fixes #320 --- core/pom.xml | 6 +++++ core/src/main/java/com/yahoo/ycsb/Client.java | 27 ++++++++++++------- core/src/main/resources/project.properties | 1 + 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 core/src/main/resources/project.properties diff --git a/core/pom.xml b/core/pom.xml index be71176e..e914c5c0 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -57,6 +57,12 @@ LICENSE file. </dependency> </dependencies> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/core/src/main/java/com/yahoo/ycsb/Client.java b/core/src/main/java/com/yahoo/ycsb/Client.java index 73f1eaa9..d6477256 100644 --- a/core/src/main/java/com/yahoo/ycsb/Client.java +++ b/core/src/main/java/com/yahoo/ycsb/Client.java @@ -771,16 +771,7 @@ public class Client double targetperthread=((double)target)/((double)threadcount); targetperthreadperms=targetperthread/1000.0; } - - System.out.println("YCSB Client 0.1"); - System.out.print("Command line:"); - for (int i=0; i<args.length; i++) - { - System.out.print(" "+args[i]); - } - System.out.println(); - System.err.println("Loading workload..."); - + //show a warning message that creating the workload is taking a while //but only do so if it is taking longer than 2 seconds //(showing the message right away if the setup wasn't taking very long was confusing people) @@ -809,6 +800,22 @@ public class Client //load the workload ClassLoader classLoader = Client.class.getClassLoader(); + try { + Properties projectProp = new Properties(); + projectProp.load(classLoader.getResourceAsStream("project.properties")); + System.err.println("YCSB Client " + projectProp.getProperty("version")); + } catch (IOException e) { + System.err.println("Unable to retrieve client version."); + } + + System.err.print("Command line:"); + for (int i=0; i<args.length; i++) + { + System.err.print(" "+args[i]); + } + System.err.println(); + System.err.println("Loading workload..."); + Workload workload=null; try diff --git a/core/src/main/resources/project.properties b/core/src/main/resources/project.properties new file mode 100644 index 00000000..defbd482 --- /dev/null +++ b/core/src/main/resources/project.properties @@ -0,0 +1 @@ +version=${project.version} -- GitLab