Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant target is not displaying results in eclipse

 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a help target in my build.xml as follows -

<target name="help">
<java fork="no" classname="org.apache.tools.ant.Main">
<arg line="-projecthelp"/>
</java>
</target>

When I run this target from command prompt, it gives me a list of targets belonging to this build.xml but when I run same command from eclipse, it is not returning any result and just says build successful. It is not showing any error but not returning any results also. All other ant targets from this build.xml are running fine through eclipse only the help target mentioned above it having a problem.

Can anybody help me in resolving this issue.

Thanks,
Grishma
 
Balagopal Kannampallil
Ranch Hand
Posts: 136
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the build Targets and the classpath to include all the required jar files properly.
 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked the classpath but not sure what is missing exactly, since it is not throwing any error in eclipse but just shows "BUILD SUCCESSFUL".

So even though I am missing something, unable to get what is that.
 
Balagopal Kannampallil
Ranch Hand
Posts: 136
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running only the "help" target from eclipse or are you calling this "help" target from a default target?
 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am calling only help target and help is my default target also.
 
Balagopal Kannampallil
Ranch Hand
Posts: 136
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you paste your complete build.xml inside a [code] tag so that we can investigate further?
 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


There are some other targets like build, which I cannot post here since these are very lengthy. But they are working fine.
 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am noticing a weird behavior in eclipse. Instead of -projecthelp, if I give arg line="-v", then it is correctly printing the version of ant on console but still not giving any result for -projecthelp.
 
Balagopal Kannampallil
Ranch Hand
Posts: 136
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When run from the command prompt the class which you are providing is taken from the global path (If you have set the global ANT_HOME or included the jars in the path) but at the same time when you try to run it from eclipse, I think its not able to pick the class which you are providing, Are you able to see some errors when you turn on the fork and trying?
 
Balagopal Kannampallil
Ranch Hand
Posts: 136
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it . Include the class path also in the target. I did something like this and its working

 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Balagopal. It is working now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic