diff --git a/build.xml b/build.xml index 485fe1d77..b93455576 100644 --- a/build.xml +++ b/build.xml @@ -369,6 +369,29 @@ under the License. + + + + + + + + + + + + + + + + + + @@ -950,7 +973,7 @@ FORREST_HOME environment variable! - + diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index e1a1872be..c043624b6 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 35583 - Include a version class, org.apache.poi.Version, to allow easy introspection of the POI version Allow the cloning of one HSSFCellStyle onto another, including cloning styles from one HSSFWorkbook onto another 45289 - finished support for special comparison operators in COUNTIF 45126 - Avoid generating multiple NamedRanges with the same name, which Excel dislikes diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index b6cb13dad..a12e6dd7f 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 35583 - Include a version class, org.apache.poi.Version, to allow easy introspection of the POI version Allow the cloning of one HSSFCellStyle onto another, including cloning styles from one HSSFWorkbook onto another 45289 - finished support for special comparison operators in COUNTIF 45126 - Avoid generating multiple NamedRanges with the same name, which Excel dislikes diff --git a/src/resources/version/Version.java.template b/src/resources/version/Version.java.template new file mode 100644 index 000000000..716ec916b --- /dev/null +++ b/src/resources/version/Version.java.template @@ -0,0 +1,69 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi; + +/** + * Administrative class to keep track of the version number of the + * POI release. + * + * This class implements the upcoming standard of having + * org.apache.project-name.Version.getVersion() be a standard + * way to get version information. + */ +public class Version { + private static final String VERSION_STRING = "@VERSION@"; + private static final String RELEASE_DATE = "@DSTAMP@"; + + /** + * Return the basic version string, of the form + * nn.nn(.nn) + */ + public static String getVersion() { + return VERSION_STRING; + } + + /** + * Return the date of the release / build + */ + public static String getReleaseDate() { + return RELEASE_DATE; + } + + /** + * Name of product: POI + */ + public static String getProduct() { + return "POI"; + } + /** + * Implementation Language: Java + */ + public static String getImplementationLanguage() { + return "Java"; + } + + /** + * Prints the version to the command line + */ + public static void main(String[] args) { + System.out.println( + "Apache " + getProduct() + " " + + getVersion() + " (" + getReleaseDate() + ")" + ); + } +}