Steve Lewis lordjoe2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [seajug]
2014-06-05 12:24:53 UTC
I have a Maven project that I am developing with IntelliJ. There is a class
which reads a version from a resource.
public class Version {
public static final String SNAPSHOT = "BAD_VERSION";
public static String version = SNAPSHOT;
static {
// get the location of version property file
URL versionPropertyFileUrl =
Version.class.getClassLoader().getResource("version.properties");
// load version property file
final Properties versionProperties = new Properties();
try {
versionProperties.load(new FileInputStream(new
File(versionPropertyFileUrl.toURI())));
final String property =
versionProperties.getProperty("algorithm.version");
if (!property.startsWith("$")) {
version = property;
}
} catch (Exception e) {
version = SNAPSHOT;
}
}
}
The version.properteis looks like this
algorithm.version = ${artifact.artifactId}-${artifact.baseVersion}
The problem is that a release build sees the correct version but if I run
in the debugger I get BAD_VERSION -
Is there a way to get Maven or some other build process to update the
resource in the trunk so that each run from the trunk at least shows the
version as the last tagged version??
which reads a version from a resource.
public class Version {
public static final String SNAPSHOT = "BAD_VERSION";
public static String version = SNAPSHOT;
static {
// get the location of version property file
URL versionPropertyFileUrl =
Version.class.getClassLoader().getResource("version.properties");
// load version property file
final Properties versionProperties = new Properties();
try {
versionProperties.load(new FileInputStream(new
File(versionPropertyFileUrl.toURI())));
final String property =
versionProperties.getProperty("algorithm.version");
if (!property.startsWith("$")) {
version = property;
}
} catch (Exception e) {
version = SNAPSHOT;
}
}
}
The version.properteis looks like this
algorithm.version = ${artifact.artifactId}-${artifact.baseVersion}
The problem is that a release build sees the correct version but if I run
in the debugger I get BAD_VERSION -
Is there a way to get Maven or some other build process to update the
resource in the trunk so that each run from the trunk at least shows the
version as the last tagged version??
--
Steven M. Lewis PhD
4221 105th Ave NE
Kirkland, WA 98033
206-384-1340 (cell)
Skype lordjoe_com
Steven M. Lewis PhD
4221 105th Ave NE
Kirkland, WA 98033
206-384-1340 (cell)
Skype lordjoe_com