Commit 381dbe18 authored by Mark's avatar Mark

Handle errors with unsubstitued properties.

parent b2e2844b
......@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
public class DependencyVersionUtils {
private static final String UNSUBSTITUED_PROJECT_VERSION = "${project.version}";
private static final Logger LOGGER = LoggerFactory.getLogger(DependencyVersionUtils.class);
......@@ -30,7 +31,8 @@ public class DependencyVersionUtils {
final InputStream pomPropertiesStream = DependencyVersionUtils.class.getResourceAsStream(pomPropertiesFile);
final InputStream testPomPropertiesStream = DependencyVersionUtils.class.getResourceAsStream(TEST_POM_PROPERTIES);
final InputStream testPomPropertiesStream = DependencyVersionUtils.class
.getResourceAsStream(TEST_POM_PROPERTIES);
String version = fallbackVersion;
......@@ -51,12 +53,19 @@ public class DependencyVersionUtils {
try {
properties.load(testPomPropertiesStream);
version = properties.getProperty(VERSION);
final String testVersion = properties.getProperty(VERSION);
if (!testVersion.equals(UNSUBSTITUED_PROJECT_VERSION)) {
version = testVersion;
} else {
LOGGER.warn("Value not substituted in " + TEST_POM_PROPERTIES + ", falling back to version "
+ fallbackVersion);
}
} catch (final IOException e) {
LOGGER.warn("Error reading " + testPomPropertiesStream + " [" + e + "], falling bak to version "
LOGGER.warn("Error reading " + testPomPropertiesStream + " [" + e + "], falling back to version "
+ fallbackVersion);
}
} else {
LOGGER.warn(
"Couldn't find " + pomPropertiesFile + " on classpath, falling back to version " + fallbackVersion);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment