Rodrigo B. de Oliveira wrote:
Hi, I'm migrating an ant based build file to nant. One of the things I need to migrate is the invocation of the java vm passing a classpath as an argument, ant allows one to do it like this:Right now there is no support for this in the exec task directly although now that I think about it it seems reasonable to have a fileset child element on <exec> that just passes the files a list of quoted strings at the end of the arg list - although not all commandline apps will want it formatted that way.
<java classname="junit.textui.TestRunner"> <classpath> <fileset dir="jsunit/lib"> <include name="*.jar"/> </fileset> <fileset dir="jsunit/bin"> <include name="jsunit.jar"/> </fileset> </classpath> <arg value="net.jsunit.StandaloneTest" /> </java>
My question is how can I achieve the same effect with the exec task?
<exec program="java">
<!-- is there any way to get a filelist from a fileset and put it here? -->
<arg value="-cp ?????" />
<arg value="junit.textui.TestRunner" />
<arg value="net.jsunit.StandaloneTest" />
</exec>
Heres how you could do it using the <script> task:
<project name="test" > <script language="C#"> <imports> <import name="NAnt.Core.Types" /> </imports> <code><![CDATA[ [Function("fileset-tolist")] public string FileSetToList( string fset ) { FileSet fs = (FileSet)Project.DataTypeReferences[fset]; StringBuilder sb = new StringBuilder(); foreach(string file in fs.FileNames ){ sb.AppendFormat(" \"{0}\" ", file ); } return sb.ToString(); }
]]></code>
</script>
<fileset id="foo">
<include name="*.jar"/>
</fileset>
<exec program="java"> <arg value="${script::fileset-tolist('foo')}" />
</exec>
</project>
I'm also considering implementing a java task just for the fun of it but I'd like to keep my life simple :)
A java task would be kinda cool - somthing that works ikvm would be awesome.
Ian
------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users