[issue 802] Simplified by using a Maven-provided and generated file instead of jclouds-version.properties

This commit is contained in:
Andrew Phillips 2012-01-08 15:49:57 -05:00
parent add431a329
commit 54506e6da5
5 changed files with 12 additions and 21 deletions

View File

@ -114,24 +114,6 @@
</dependencies> </dependencies>
<build> <build>
<resources>
<resource>
<directory>${project.basedir}/src/main/clojure</directory>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<excludes>
<exclude>META-INF/jclouds-version.properties</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>META-INF/jclouds-version.properties</include>
</includes>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>

View File

@ -36,8 +36,8 @@ import com.google.common.annotations.VisibleForTesting;
*/ */
public class JcloudsVersion { public class JcloudsVersion {
@VisibleForTesting @VisibleForTesting
static final String VERSION_RESOURCE_FILE = "META-INF/jclouds-version.properties"; static final String VERSION_RESOURCE_FILE = "META-INF/maven/org.jclouds/jclouds-core/pom.properties";
private static final String VERSION_PROPERTY_NAME = "jclouds.version"; private static final String VERSION_PROPERTY_NAME = "version";
// TODO: stop supporting x.y.z-rc-n after the 1.3.0 release // 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 // x.y.z or x.y.z-rc.n or x.y.z-rc-n, optionally with -SNAPSHOT suffix - see http://semver.org

View File

@ -1 +0,0 @@
jclouds.version=${project.version}

View File

@ -54,6 +54,12 @@ public class JcloudsVersionTest {
new JcloudsVersion("${project.version}"); new JcloudsVersion("${project.version}");
} }
@Test
public void testExtractsVersionFromResourceFile() {
JcloudsVersion version = new JcloudsVersion();
assertEquals("0.0.0-SNAPSHOT", version.toString());
}
@Test @Test
public void testExtractsMajorMinorPatchVersions() { public void testExtractsMajorMinorPatchVersions() {
JcloudsVersion version = new JcloudsVersion("1.2.3"); JcloudsVersion version = new JcloudsVersion("1.2.3");

View File

@ -0,0 +1,4 @@
# Dummy pom.properties file for testing
version=0.0.0-SNAPSHOT
groupId=org.jclouds
artifactId=jclouds-core