diff --git a/build.xml b/build.xml
index 953854c40..e9decf94c 100644
--- a/build.xml
+++ b/build.xml
@@ -48,6 +48,7 @@
+
@@ -66,12 +67,20 @@
+
+
+
+
+
+
+
+
diff --git a/docs/index.html b/docs/index.html
index 21f80611b..b1fec3093 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -479,10 +479,10 @@ If you do not want these default excludes applied, you may disable them with the
Exec
Expand
Filter
+ FixCRLF
Get
GUnzip
GZip
- FixCRLF
Jar
Java
Javac
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 730176148..2eb4b1da4 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -116,6 +116,9 @@ public class Main {
if (arg.equals("-help") || arg.equals("help")) {
printUsage();
return;
+ } else if (arg.equals("-version")) {
+ printVersion();
+ return;
} else if (arg.equals("-quiet") || arg.equals("-q") || arg.equals("q")) {
msgOutputLevel = Project.MSG_WARN;
} else if (arg.equals("-verbose") || arg.equals("-v") || arg.equals("v")) {
@@ -328,6 +331,7 @@ public class Main {
msg.append("ant [options] [target]" + lSep);
msg.append("Options: " + lSep);
msg.append(" -help print this message" + lSep);
+ msg.append(" -version print the version information and exit" + lSep);
msg.append(" -quiet be extra quiet" + lSep);
msg.append(" -verbose be extra verbose" + lSep);
msg.append(" -logfile use given file for log" + lSep);
@@ -336,4 +340,28 @@ public class Main {
msg.append(" -D= use value for given property" + lSep);
System.out.println(msg.toString());
}
+
+ private static void printVersion() {
+ 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.");
+ }
+ }
}
diff --git a/src/main/org/apache/tools/ant/version.txt b/src/main/org/apache/tools/ant/version.txt
new file mode 100644
index 000000000..b6b2f8db9
--- /dev/null
+++ b/src/main/org/apache/tools/ant/version.txt
@@ -0,0 +1,2 @@
+VERSION=@VERSION@
+DATE=@DATE@