Reputation: 9449
I'm calling the Jasper ant task, and I want to set the org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING
environment variable. I can set ANT_OPTS to be -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
and it works correctly. However, I want a setting I can put into the build.xml, so I don't need to tell my teammates that they need to set ANT_OPTS.
I've tried
<property name="env.org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING"
value="false"/>
but that doesn't seem to work.
How can I pass an environment variable to an ant task?
EDIT: By "doesn't work", I mean I get an error saying an attribute is quoted with " which must be escaped when used within the value
If I set it via ANT_OPTS, I do not get this error.
Upvotes: 2
Views: 3902
Reputation: 107040
Use the <property>
task to define an environmental prefix:
<property environment="env"/>
Now, you can simply prepend env.
to your environment variable and treat it like an already defined Ant property:
<property environment="env"/>
<echo message="My path is "${env.PATH}""/>
Upvotes: 3