wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Linux diff command failing from ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Linux diff command failing from ANT" Watch "Linux diff command failing from ANT" New topic

Linux diff command failing from ANT

Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Hi All,

I am trying to run a Linux command from ant and facing the following errors,

Script Task:

<exec executable="/usr/bin/diff" failonerror="true" output="Main_Agg_diff.log">
<arg line="TAOuput.log TLPOuput.log"/>

Error is :

[exec] Current OS is Linux
[exec] Output redirected to /home/ajay/TATest/Main_Agg_diff.log
[exec] Executing '/usr/bin/diff' with arguments:
[exec] 'TAOuput.log'
[exec] 'TLPOuput.log'
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.

/home/ajay/TATest/build.xml:36: exec returned: 1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:591)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:617)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:452)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Please help me over this.

Thanks in advance.

SCJP 1.4.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641

You set "failOnError" true. If diff detects that 2 files are different, it returns non-zero (specifically, it returned 1). This was detected as failure, which terminated Ant.

From what I can see, Ant did exactly what you told it to.

Customer surveys are for companies who didn't pay proper attention to begin with.
Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Thanks a Ton Tim. It has worked for me now.

I agree. Here's the link: http://aspose.com/file-tools
subject: Linux diff command failing from ANT
Similar Threads
Ant deployment on iAS 6.5
sshexec throwing exceptions when i run from ant
run Perl script from Ant file
Problem in Ant build.xml to call WSDL2Java.bat
Ant SshExec task throwing JschException : Auth fail