At 02:26 AM 9/9/2006, Chris Chiasson wrote:
>I realize it was a long shot. Thanks for the reply.
>
>On Fri, 8 Sep 2006 13:00:01 UT, mathgroup <mathgroup at smc.vnet.net> wrote:
> > -- Wolfram Research Technical Support --
> >
> > This is a response to your email.
> > The reply to your question can be found at the bottom of this message.
> > Our classification number for this message is: [TS 22578]
> > Please give this number in any future correspondence
> > related to this question. If you leave this number in
> > the Subject: [mg69382] [mg69359] header in the form [TS 22578], it will
> > automatically be reassigned to the original technician.
> >
> > From: "Chris Chiasson" <chris at chiasson.name>
To: mathgroup at smc.vnet.net
>To: mathgroup at smc.vnet.net
> > Date: Sun, 3 Sep 2006 05:40:34 -0500
> > Subject: [mg69382] [mg69359] does anyone have an ant task for mathematica?
> > To: mathgroup <mathgroup at smc.vnet.net>,"support at wolfram.com"
> <support at wolfram.com>
> >
> > Assumedly, it would be able to start Mathematica, execute some .m
> > files, and then return control back to ant.
Chris,
In fact, there already _is_ an Ant task for this in J/Link. It was added in
J/Link 3.1, so anyone with Mathematica 5.2 or later already has it, and
anyone else can download the latest J/Link version from
http://www.wolfram.com/solutions/mathlink/jlink/.
We use Ant for many things within WRI, and its use is growing, so it was
essential to have a task that could call Mathematica. We snuck the class
into J/Link 3.1 without documenting it, as it was experimental at the time,
and we wanted to make it available to internal users. It has since had some
features added to it, and it will be documented as a first-class component
of J/Link in the next release.
You can see the source code for the class in
AddOns/JLink/Source/Java/com/wolfram/jlink/util/MathematicaTask.java. You
will have to look at that file, because it contains the documentation on
how to use the task. In addition to executing arbitrary Mathematica code,
you can also interact with Ant, such as calling tasks, getting/setting
properties, etc. Here is a simple example:
<mathematica exe="c:/program files/wolfram
research/mathematica/5.2/mathkernel">
<![CDATA[
Get["MyTestPackage`"];
result = CallTestFunction[];
If[!TrueQ[result],
AntFail["Mathematica test function failed"]
]
]]>
</mathematica>
Todd Gayley
Wolfram Research