Hi,
My problem involved the attribute jvmarg set to a property which value is ""... Using Ant 1.6.4, I am using the java task to launch various process: / <java classname="${classname}">/ / <arg value="${arg1}" />/ / <arg value="${arg2}" />/ / <jvmarg value="${jvmarg1}" />/ / <jvmarg value="${jvmarg2}" />/ / </java>/ For each class the properties (arg1, arg2, jvmarg1, jvmarg2,etc. ) are loaded from xml file. After that, for each undefined property, its value is set to "". As a property cannot be overwritten, it behaves as defining a default value. This is working fine as long as jvmarg1 & jvmarg2 properties have a value but breaks when they use "" as default value. Running ant -debug gives the following: /''/ /''/ /The ' characters around the executable and arguments are/ /not part of the command./ / [java] Exception in thread "main" java.lang.NoClassDefFoundError:/ /BUILD FAILED/ It seems that empty jvmarg is the caused but I need to find a way to inhibit jvmarg attribute when the associated property is not used. This basically, the same problem as mentionned at this link: http://www.jguru.com/forums/view.jsp?EID=1275301 But the switch/case-like solution given is not flexible enough for my needs. Hope somebody faced & solved this issue before ;) Thank you, Frederic CHALONS --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Frederic Chalons wrote:
> Hi, > > My problem involved the attribute jvmarg set to a property which value > is ""... > > Using Ant 1.6.4, I am using the java task to launch various process: > > / <java classname="${classname}">/ > / <arg value="${arg1}" />/ > / <arg value="${arg2}" />/ > / <jvmarg value="${jvmarg1}" />/ > / <jvmarg value="${jvmarg2}" />/ > / </java>/ > > For each class the properties (arg1, arg2, jvmarg1, jvmarg2,etc. ) are > loaded from xml file. > After that, for each undefined property, its value is set to "". > As a property cannot be overwritten, it behaves as defining a default > value. > > This is working fine as long as jvmarg1 & jvmarg2 properties have a > value but breaks when they use "" as default value. > Running ant -debug gives the following: > > /''/ > /''/ > > /The ' characters around the executable and arguments are/ > /not part of the command./ > / [java] Exception in thread "main" java.lang.NoClassDefFoundError:/ > > /BUILD FAILED/ > > It seems that empty jvmarg is the caused but I need to find a way to > inhibit jvmarg attribute when the associated property is not used. Alternatively, you need a default JVM argument that can be used multiple times and has no side effects, and make that the default. the -ea option to enable assertions for a package may work there... --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Steve Loughran wrote: > Frederic Chalons wrote: > >> Hi, >> >> My problem involved the attribute jvmarg set to a property which >> value is ""... >> >> Using Ant 1.6.4, I am using the java task to launch various process: >> >> / <java classname="${classname}">/ >> / <arg value="${arg1}" />/ >> / <arg value="${arg2}" />/ >> / <jvmarg value="${jvmarg1}" />/ >> / <jvmarg value="${jvmarg2}" />/ >> / </java>/ >> >> For each class the properties (arg1, arg2, jvmarg1, jvmarg2,etc. ) >> are loaded from xml file. >> After that, for each undefined property, its value is set to "". >> As a property cannot be overwritten, it behaves as defining a default >> value. >> >> This is working fine as long as jvmarg1 & jvmarg2 properties have a >> value but breaks when they use "" as default value. >> Running ant -debug gives the following: >> >> /''/ >> /''/ >> >> /The ' characters around the executable and arguments are/ >> /not part of the command./ >> / [java] Exception in thread "main" >> java.lang.NoClassDefFoundError:/ >> >> /BUILD FAILED/ >> >> It seems that empty jvmarg is the caused but I need to find a way to >> inhibit jvmarg attribute when the associated property is not used. > > > Alternatively, you need a default JVM argument that can be used > multiple times and has no side effects, and make that the default. > > the -ea option to enable assertions for a package may work there... > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] Hi Steve, Thank you for your insight. By the way, I was given another workaround by defining a system property as default value. ex: <property name="arg1" value="-Dtoto="titi" /> This not very elegant but it works as a charm :-) Regards, Frederic --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Free forum by Nabble | Edit this page |