Skip to content

Commit

Permalink
Use a Maven properties file
Browse files Browse the repository at this point in the history
Change-Id: Ic26a63a29ed12cf27c1393defefc1c02eeac1746
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
  • Loading branch information
egonw authored and johnmay committed May 3, 2014
1 parent 6cdbca9 commit b872a15
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions base/core/pom.xml
Expand Up @@ -30,4 +30,22 @@
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>org/openscience/cdk/config/data/*</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>build.props</exclude>
</excludes>
</resource>
</resources>
</build>

</project>
2 changes: 2 additions & 0 deletions base/core/src/main/resources/build.props
@@ -0,0 +1,2 @@
# needed for CDK.getVersion() using the trick explained at http://stackoverflow.com/a/3697482/217943
version=${project.version}
4 changes: 4 additions & 0 deletions base/test-core/src/test/java/org/openscience/cdk/CDKTest.java
Expand Up @@ -36,6 +36,10 @@ public void testGetVersion() {
"There was an error retrieving the CDK version.",
"ERROR", CDK.getVersion()
);
Assert.assertFalse(
"The CDK version in build.props is not properly overwritten by Maven.",
CDK.getVersion().contains("project.version")
); // see for the expected behavior: http://stackoverflow.com/a/3697482/217943
}

}

0 comments on commit b872a15

Please sign in to comment.