public final class Version extends Object
The property files only defines one property. Import is to switch resource filtering on in your POM for that properties file.
version=1.0.0
This property file may be processed by a Maven filter to provide the verison from the pom.xml:
version=${pom.version}
If you save the file in src/main/resources/foo/bar/version.properties you can use the version this way:
Version version = new Version("/foo/bar/version.properties");
version.load()
println(version.getVersion);
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
Version.PropertyNames
Available properties in the file.
|
| Modifier and Type | Field and Description |
|---|---|
private Properties |
properties
Properties.
|
private boolean |
propertiesLoaded
Indicates whether the properties are already loaded or not.
|
private String |
propertyFileName
Location of property file.
|
| Constructor and Description |
|---|
Version(String propertyFileName)
Private constructor for singleton.
|
private final String propertyFileName
private boolean propertiesLoaded
private final Properties properties
public Version(String propertyFileName)
propertyFileName - Location of file, e.g. /de/weltraumschaf/commons/version.properties.public void load()
throws IOException
IOException - On IO errors of the property file.void loadImpl()
throws IOException
IOException - On IO errors of the property file.public String getVersion()
public String toString()
toString in class ObjectgetVersion().Copyright © 2012 Sven Strittmatter. All Rights Reserved.