We need to test a java build with the languages set to different values. I can manually (i.e. via export LANG=en_DK.UTF-8 and export LANG=en_DK) test that the unit tests run with the ant build script behaves differently, but I need to set the environment variable from ant. I have tried setting it using these methods (with the shell $LANG set to en_DK.UTF-8):
- using
-Don the command line:ant -DLANG=en_DK - using a
build.propertiesfile with the lineLANG=en_DKin it - using the following statements in the build.xml file (sorry for the formatting, I can’t get SO to display it otherwise):
:
<property environment="ANTENV"/>
<property name="ANTENV.LANG" value="en_DK"/>
Using any of the three possibilities, and when run with -debug, ant reports that:
Override ignored for property "LANG"
What can I do to set the LANG environment variable from within ant?
ANT Properties are immutable,
may be be interpreted by ant as an attempt to override the
LANGvalue already present when storing all the environment variables inANTENV(with<property environment="ANTENV"/>).So you need to store to store that value in a separate property.