location |
@@ -165,6 +166,9 @@ href="../using.html#path">PATH like structure and can also be set via a nest
<property name="foo.dist" value="dist"/>
sets the property foo.dist
to the value "dist".
+ <property name="foo.dist">dist</property>
+sets the property foo.dist
to the value "dist".
+
<property file="foo.properties"/>
reads a set of properties from a file called "foo.properties".
diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java
index 0eb3bb151..81f621e10 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Property.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Property.java
@@ -44,13 +44,17 @@ import org.apache.tools.ant.property.ResolvePropertyMap;
* resource) in the project.
* Properties are immutable: whoever sets a property first freezes it for the
* rest of the build; they are most definitely not variable.
- * There are five ways to set properties:
+ * There are seven ways to set properties:
*
* - By supplying both the name and value attribute.
+ * - By supplying the name and nested text.
* - By supplying both the name and refid attribute.
* - By setting the file attribute with the filename of the property
* file to load. This property file has the format as defined by the file used
* in the class java.util.Properties.
+ * - By setting the url attribute with the url from which to load the
+ * properties. This url must be directed to a file that has the format as defined
+ * by the file used in the class java.util.Properties.
* - By setting the resource attribute with the resource name of the
* property file to load. This property file has the format as defined by the
* file used in the class java.util.Properties.
@@ -172,6 +176,20 @@ public class Property extends Task {
setValue((Object) value);
}
+ /**
+ * Set a (multiline) property as nested text.
+ * @param msg the text to append to the output text
+ * @since Ant 1.8.0
+ */
+ public void addText(String msg) {
+ msg = getProject().replaceProperties(msg);
+ String currentValue = getValue();
+ if (currentValue != null) {
+ msg = currentValue + msg;
+ }
+ setValue(msg);
+ }
+
/**
* Get the property value.
* @return the property value
diff --git a/src/tests/antunit/taskdefs/property-test.xml b/src/tests/antunit/taskdefs/property-test.xml
new file mode 100644
index 000000000..d1fe3644b
--- /dev/null
+++ b/src/tests/antunit/taskdefs/property-test.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+ bar
+
+
+