Do you know how to modify properties in ant?
Submitted by: AdministratorAnt properties are immutable; they cannot be changed once initialized. However, it can be done in the following way although it causes the immutable property violation:
<?xml version="1.0"?>
<project name="example" default="run">
<taskdef name="groovy"
classname="org.codehaus.groovy.ant.Groovy"
classpath="lib/groovy-all-1.1-rc-1.jar"/>
<target name="run">
<echo>java.library.path = ${java.library.path}</echo>
<groovy>
properties["java.library.path"] = "changed"
</groovy>
<echo>java.library.path = ${java.library.path}</echo>
</target>
</project>
Submitted by: Administrator
<?xml version="1.0"?>
<project name="example" default="run">
<taskdef name="groovy"
classname="org.codehaus.groovy.ant.Groovy"
classpath="lib/groovy-all-1.1-rc-1.jar"/>
<target name="run">
<echo>java.library.path = ${java.library.path}</echo>
<groovy>
properties["java.library.path"] = "changed"
</groovy>
<echo>java.library.path = ${java.library.path}</echo>
</target>
</project>
Submitted by: Administrator
Read Online Java ANT Job Interview Questions And Answers
Top Java ANT Questions
☺ | Tell me how to set classpath in ant? |
☺ | How to write your own ant task? |
☺ | Do you know how to debug my ant script? |
☺ | How to use ant to run a Java application? |
☺ | Tell me how to use Runtime in ant? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |