1
votes

What I want to do is:

    <exec executable="thrift" dir="${thriftsrc}">
        <arg value="--gen java"/>
        <arg value="-out ${src}"/>
        <arg value="mqlServer.idl"/>
    </exec>

I have copied thrift.exe in C:\Windows\System32\ so the file is definitely in the PATH. I have tried several executable Arguments, full path, with and without .exe but it is not working in any variant.

But this is working very well:

   <exec executable="perl" dir="${generators}">
        <arg value="compactTalib.pl"/>
        <arg value="${talibsrc}"/>
    </exec>

Any Ideas how I can get my thirft compiler invoked in my ant build?

2

2 Answers

0
votes

First, go to a DOS prompt and type in "thrift". Does it "work"? I'd expect it to give you an error, but at least find the exe. If it doesn't find the exe, solve that problem before going back to Ant.

Second, echo ${thriftsrc} in Ant. Is that C:\Windows\System32? If not, omit the dir argument. It's optional so you might remove it anyway and just use the path.

Finally, I see another problem that you haven't hit yet. This is going to get passed in as a single parameter "--gen java".

<arg value="--gen java"/>

The relevant part of the doc is:

is a single command-line argument containing a space character, not separate commands "-l" and "-a".

0
votes

This is likely how the thrift command should be called:

<exec executable="thrift" dir="${thriftsrc}">
    <arg value="--gen"/>
    <arg value="java"/>
    <arg value="-out"/>
    <arg value="${src}"/>
    <arg value="mqlServer.idl"/>
</exec>

Also, consider adding failonerror to your <exec> task:

<exec executable="thrift" dir="${thriftsrc}" failonerror="yes">

This will cause the Ant script to end with an error message which will help with troubleshooting.