Browse Source

Restore version resource

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268547 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 24 years ago
parent
commit
58d96d54fb
3 changed files with 24 additions and 9 deletions
  1. +1
    -4
      src/main/org/apache/tools/ant/Constants.java
  2. +21
    -5
      src/main/org/apache/tools/ant/Main.java
  3. +2
    -0
      src/main/org/apache/tools/ant/version.txt

+ 1
- 4
src/main/org/apache/tools/ant/Constants.java View File

@@ -12,8 +12,5 @@ package org.apache.tools.ant;
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
interface Constants
{
String DATE = "@DATE@";
String VERSION = "@VERSION@";
interface Constants {
}

+ 21
- 5
src/main/org/apache/tools/ant/Main.java View File

@@ -72,9 +72,6 @@ import java.util.*;

public class Main {

public final static String BANNER =
"Ant version " + Constants.VERSION + " compiled on " + Constants.DATE;

/** The default build file name */
public static final String DEFAULT_BUILD_FILENAME = "build.xml";

@@ -513,8 +510,27 @@ public class Main {
}

private static void printVersion() {
System.out.println( BANNER );
System.out.println();
try {
Properties props = new Properties();
InputStream in =
Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt");
props.load(in);
in.close();

String lSep = System.getProperty("line.separator");
StringBuffer msg = new StringBuffer();
msg.append("Ant version ");
msg.append(props.getProperty("VERSION"));
msg.append(" compiled on ");
msg.append(props.getProperty("DATE"));
msg.append(lSep);
System.out.println(msg.toString());
} catch (IOException ioe) {
System.err.println("Could not load the version information.");
System.err.println(ioe.getMessage());
} catch (NullPointerException npe) {
System.err.println("Could not load the version information.");
}
}

/**


+ 2
- 0
src/main/org/apache/tools/ant/version.txt View File

@@ -0,0 +1,2 @@
VERSION=@VERSION@
DATE=@DATE@

Loading…
Cancel
Save