diff --git a/manual/Tasks/script.html b/manual/Tasks/script.html
index 94c818747..043d4c63c 100644
--- a/manual/Tasks/script.html
+++ b/manual/Tasks/script.html
@@ -101,9 +101,9 @@ In particular all targets should have different location values.
setbeans |
This attribute controls whether to set variables for all properties, references and targets
- in the running script. If this attribute is false , only the the project
- and self variables are set. If this attribute is true all the variables
- are set. Since Ant 1.7 |
+ in the running script. If this attribute is false
, only the project
and
+ self
variables are set. If this attribute is true
all the variables are
+ set. Since Ant 1.7
No; defaults to true |
diff --git a/manual/Tasks/scriptdef.html b/manual/Tasks/scriptdef.html
index a741fba35..ba88bd1df 100644
--- a/manual/Tasks/scriptdef.html
+++ b/manual/Tasks/scriptdef.html
@@ -132,6 +132,14 @@ the <script>
task.
No |
+
+ setbeans |
+ This attribute controls whether to set variables for all properties, references and targets
+ in the running script. If this attribute is false , only the project and
+ self variables are set. If this attribute is true all the variables are
+ set.
+ | No; default false for backward compatibility |
+
Parameters specified as nested elements
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java b/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
index f1c5d4e80..da8ea1045 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
@@ -67,6 +67,13 @@ public class ScriptDef extends DefBase {
/** The nested element definitions indexed by their names */
private Map nestedElementMap;
+ /**
+ * Create a new {@link ScriptDef}.
+ */
+ public ScriptDef() {
+ helper.setSetBeans(false);
+ }
+
/**
* Set the project.
* @param project the project that this definition belongs to.
@@ -75,7 +82,6 @@ public class ScriptDef extends DefBase {
public void setProject(Project project) {
super.setProject(project);
helper.setProjectComponent(this);
- helper.setSetBeans(false);
}
/**
@@ -447,6 +453,20 @@ public class ScriptDef extends DefBase {
helper.setEncoding(encoding);
}
+ /**
+ * Set the setbeans attribute.
+ * If this is true, <script> will create variables in the
+ * script instance for all
+ * properties, targets and references of the current project.
+ * It this is false, only the project and self variables will
+ * be set.
+ * The default is true.
+ * @param setBeans the value to set.
+ */
+ public void setSetBeans(boolean setBeans) {
+ helper.setSetBeans(setBeans);
+ }
+
/**
* Sets the script text.
*
diff --git a/src/tests/antunit/taskdefs/optional/script/scriptdef-test.xml b/src/tests/antunit/taskdefs/optional/script/scriptdef-test.xml
index ed87a34b4..62ddda608 100644
--- a/src/tests/antunit/taskdefs/optional/script/scriptdef-test.xml
+++ b/src/tests/antunit/taskdefs/optional/script/scriptdef-test.xml
@@ -155,4 +155,14 @@
+
+
+
+ project.setNewProperty('property', sourceProperty)
+
+
+
+
+
+