From 54506e6da5a11d8aa90d8ae23b0d13e9c87329f5 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sun, 8 Jan 2012 15:49:57 -0500 Subject: [PATCH] [issue 802] Simplified by using a Maven-provided and generated file instead of jclouds-version.properties --- core/pom.xml | 18 ------------------ .../main/java/org/jclouds/JcloudsVersion.java | 4 ++-- .../META-INF/jclouds-version.properties | 1 - .../java/org/jclouds/JcloudsVersionTest.java | 6 ++++++ .../org.jclouds/jclouds-core/pom.properties | 4 ++++ 5 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 core/src/main/resources/META-INF/jclouds-version.properties create mode 100644 core/src/test/resources/META-INF/maven/org.jclouds/jclouds-core/pom.properties diff --git a/core/pom.xml b/core/pom.xml index 94bec94b7f..ebb06b6d8e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -114,24 +114,6 @@ - - - ${project.basedir}/src/main/clojure - - - ${project.basedir}/src/main/resources - - META-INF/jclouds-version.properties - - - - true - ${project.basedir}/src/main/resources - - META-INF/jclouds-version.properties - - - maven-jar-plugin diff --git a/core/src/main/java/org/jclouds/JcloudsVersion.java b/core/src/main/java/org/jclouds/JcloudsVersion.java index 000133eb41..ec36b1f524 100644 --- a/core/src/main/java/org/jclouds/JcloudsVersion.java +++ b/core/src/main/java/org/jclouds/JcloudsVersion.java @@ -36,8 +36,8 @@ import com.google.common.annotations.VisibleForTesting; */ public class JcloudsVersion { @VisibleForTesting - static final String VERSION_RESOURCE_FILE = "META-INF/jclouds-version.properties"; - private static final String VERSION_PROPERTY_NAME = "jclouds.version"; + static final String VERSION_RESOURCE_FILE = "META-INF/maven/org.jclouds/jclouds-core/pom.properties"; + private static final String VERSION_PROPERTY_NAME = "version"; // TODO: stop supporting x.y.z-rc-n after the 1.3.0 release // x.y.z or x.y.z-rc.n or x.y.z-rc-n, optionally with -SNAPSHOT suffix - see http://semver.org diff --git a/core/src/main/resources/META-INF/jclouds-version.properties b/core/src/main/resources/META-INF/jclouds-version.properties deleted file mode 100644 index 0169c2f63f..0000000000 --- a/core/src/main/resources/META-INF/jclouds-version.properties +++ /dev/null @@ -1 +0,0 @@ -jclouds.version=${project.version} \ No newline at end of file diff --git a/core/src/test/java/org/jclouds/JcloudsVersionTest.java b/core/src/test/java/org/jclouds/JcloudsVersionTest.java index 14f4a23670..99acf27984 100644 --- a/core/src/test/java/org/jclouds/JcloudsVersionTest.java +++ b/core/src/test/java/org/jclouds/JcloudsVersionTest.java @@ -54,6 +54,12 @@ public class JcloudsVersionTest { new JcloudsVersion("${project.version}"); } + @Test + public void testExtractsVersionFromResourceFile() { + JcloudsVersion version = new JcloudsVersion(); + assertEquals("0.0.0-SNAPSHOT", version.toString()); + } + @Test public void testExtractsMajorMinorPatchVersions() { JcloudsVersion version = new JcloudsVersion("1.2.3"); diff --git a/core/src/test/resources/META-INF/maven/org.jclouds/jclouds-core/pom.properties b/core/src/test/resources/META-INF/maven/org.jclouds/jclouds-core/pom.properties new file mode 100644 index 0000000000..6cc82e2bb3 --- /dev/null +++ b/core/src/test/resources/META-INF/maven/org.jclouds/jclouds-core/pom.properties @@ -0,0 +1,4 @@ +# Dummy pom.properties file for testing +version=0.0.0-SNAPSHOT +groupId=org.jclouds +artifactId=jclouds-core