Merged fix for 21917 from HEAD.
diff --git a/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntRunner.java b/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntRunner.java
index c9312e0..7c16d16 100644
--- a/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntRunner.java
+++ b/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntRunner.java
@@ -32,7 +32,7 @@
 	protected Map userProperties;
 	protected int messageOutputLevel = 2; // Project.MSG_INFO
 	protected String buildLoggerClassName;
-	protected String arguments;
+	protected String[] arguments;
 
 /** 
  * Constructs an instance of this class.
@@ -84,11 +84,54 @@
  * @param arguments the arguments to be passed to the script
  */
 public void setArguments(String arguments) {
-	this.arguments = arguments;
+	this.arguments = getArray(arguments);
 }
 
 /**
- * Sets the targets and execution order.
+ * Helper method to ensure an array is converted into an ArrayList.
+ */
+private String[] getArray(String args) {
+	StringBuffer sb = new StringBuffer();
+	boolean waitingForQuote = false;
+	ArrayList result = new ArrayList();
+	for (StringTokenizer tokens = new StringTokenizer(args, ", \"", true); tokens.hasMoreTokens();) { //$NON-NLS-1$
+		String token = tokens.nextToken();
+		if (waitingForQuote) {
+			if (token.equals("\"")) { //$NON-NLS-1$
+				result.add(sb.toString());
+				sb.setLength(0);
+				waitingForQuote = false;
+			} else
+				sb.append(token);
+		} else {
+			if (token.equals("\"")) { //$NON-NLS-1$
+				// test if we have something like -Dproperty="value"
+				if (result.size() > 0) {
+					int index = result.size() - 1;
+					String last = (String) result.get(index);
+					if (last.charAt(last.length()-1) == '=') {
+						result.remove(index);
+						sb.append(last);
+					}
+				}
+				waitingForQuote = true;
+			} else {
+				if (!(token.equals(",") || token.equals(" "))) //$NON-NLS-1$ //$NON-NLS-2$
+					result.add(token);
+			}
+		}
+	}
+	return (String[]) result.toArray(new String[result.size()]);
+}
+
+/**
+ * Sets the arguments to be passed to the script (e.g. -Dos=win32 -Dws=win32 -verbose).
+ * 
+ * @param arguments the arguments to be passed to the script
+ */
+public void setArguments(String[] arguments) {
+	this.arguments = arguments;
+} * Sets the targets and execution order.
  * 
  * @param executionTargets which targets should be run and in which order
  */
@@ -180,7 +223,7 @@
 		}
 		// set extra arguments
 		if (arguments != null) {
-			Method setArguments = classInternalAntRunner.getMethod("setArguments", new Class[] {String.class}); //$NON-NLS-1$
+			Method setArguments = classInternalAntRunner.getMethod("setArguments", new Class[] {String[].class}); //$NON-NLS-1$
 			setArguments.invoke(runner, new Object[] {arguments});
 		}
 		// run
@@ -202,7 +245,7 @@
  * Runs the build script.
  */
 public void run() throws CoreException {
-	run(null);
+	run((IProgressMonitor) null);
 }
 
 /**
@@ -279,4 +322,14 @@
 		String message = (e.getMessage() == null) ? Policy.bind("error.buildFailed") : e.getMessage(); //$NON-NLS-1$
 		throw new CoreException(new Status(IStatus.ERROR, PI_ANTCORE, ERROR_RUNNING_SCRIPT, message, e));
 	}
-}}
\ No newline at end of file
+}
+
+/**
+ * Sets the arguments to be passed to the script (e.g. -Dos=win32 -Dws=win32 -verbose).
+ * 
+ * @param arguments the arguments to be passed to the script
+ */
+public void setArguments(String[] arguments) {
+	this.arguments = arguments;
+}
+}
\ No newline at end of file