ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Leal "Valmaña" <>
Subject Problem setting the user.language for task junit
Date Thu, 06 Nov 2003 19:36:20 GMT
Hello members,
If I set on the ant line command the property user.language, for example to en (my default
user languages is es), when running ant the change takes effect, but my testing class executed
during junit task use still the english language. 
If I execute my testing class not using ant, so, just simply invoking java, setting the user.language
options, for example:
java -Duser.language=es isf.util.UtilSuiteTest
it works, why?
If I execute my junit target (invoke-junit):
ant -Duser.language=en -v invoke-junit
Effectivelly the user.language has value en, but on the information about the System Properties
used for the task:
[junit] Using System properties {..., user.language=es, ...}

so, internally junit, uses the System properties, not the value defined by me. This is my
If I try them to fork the Virtual Machine, setting the attribute to true:
<junit fork = true ..../> in order to set this property using the <jvmarg value =
"-Duser.language=${user.language}"/> as nested element.
I get the following error:
    [junit] java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/optional/junit/J
 so, it doesn't find the UnitTestRunner. I have read the documentation on the FAQ: about this
problem for junit and the class loader process:
Question: "<style> or <junit> ignores my <classpath>"
I have followed the recomendation about using the Second Option with Ant 1.5.3 and Earlier:

If you want to avoid to <taskdef> all optional tasks you need, the only other option
is to remove the classes that should not be loaded via the bootstrap class loader from optional.jar
and put them into a separate archive. Add this separate archive to the <classpath> of
your <style> or <junit> task - and make sure the separate archive is not in CLASSPATH.

In the case of <junit> you'd have to remove all classes that are in the org/apache/tools/ant/taskdefs/optional/junit
directory, in the <style> case it is one of the *Liaison classes in org/apache/tools/ant/taskdefs/optional.

After doing that, I get the following error:Could create the task or type junit.

If I add the separate jar with the tasdef for junit only on the CLASSPATH environment variable,
then I get the following error, when fork is true (when it is false, I don't get any error,
but the language is still spanish):

   [junit] java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
   [junit] Exception in thread "main"

I suspect that I have to fork the virtual machine in order to change the user language, but
this is not possible I get by one way or the other a different errors

I am using the ant version: 1.5.4 compiled on August 12 2003

Do you have any recomendation about who to solve this problem?

Thanks in advance,




David Leal Valmaña


91 210 33 00 ext. 71 923


91 597 05 62


Soluziona, Grupo Unión Fenosa

Calle Pedro Texeira 8 2da Planta. Madrid 28020


Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message