This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Linux diff command failing from ANT

 
Ajay Vikas
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"/>
</exec>

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]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.

BUILD FAILED
/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.

--
Ajay.
SCJP 1.4.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18163
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ajay Vikas
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a Ton Tim. It has worked for me now.

--
Ajay.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic