Skip to main content



      Home
Home » Newcomers » Newcomers » how do I run an Ant target from Eclipse??
how do I run an Ant target from Eclipse?? [message #259201] Wed, 25 June 2008 15:14 Go to next message
Eclipse UserFriend
I have an Ant script (build.xml) that contains a few targets.
I've added this file to the Ant Viewer, which lists the targets.
I click on one of the targets and click the toolbar button on that
viewer that looks like a green circle with a white arrow. The tool tip
for this button says "Run the Selected Target".

Each of my targets call <echo> and write something to a file.
When I attempt to run the target as described above, nothing is written
to the file. Thus it appears that Eclipse did not run the And script at all.

Yet, if I open a cmd window (yes I'm running under Windows) and I run
the command "ant debug" (debug is the name of one of my targets) then it
runs as expected.

So... how do I run an Ant target from Eclipse?

Thanks,
Paul
Re: how do I run an Ant target from Eclipse?? [message #259348 is a reply to message #259201] Thu, 26 June 2008 14:41 Go to previous messageGo to next message
Eclipse UserFriend
Paul,

I am unable to reproduce your problem....my target and/or buildfile runs
just fine.

If you go to the debug perspective and look in the debug view, are there any
terminated launches showing up?

And yes, I am running on Windows as well :-)
Darins
http://runnerwhocodes.blogspot.com

"Paul Levin" <paul@apcl.us> wrote in message
news:g3u5ib$cof$1@build.eclipse.org...
>I have an Ant script (build.xml) that contains a few targets.
> I've added this file to the Ant Viewer, which lists the targets.
> I click on one of the targets and click the toolbar button on that viewer
> that looks like a green circle with a white arrow. The tool tip for this
> button says "Run the Selected Target".
>
> Each of my targets call <echo> and write something to a file.
> When I attempt to run the target as described above, nothing is written to
> the file. Thus it appears that Eclipse did not run the And script at all.
>
> Yet, if I open a cmd window (yes I'm running under Windows) and I run the
> command "ant debug" (debug is the name of one of my targets) then it runs
> as expected.
>
> So... how do I run an Ant target from Eclipse?
>
> Thanks,
> Paul
Re: how do I run an Ant target from Eclipse?? [message #259369 is a reply to message #259201] Fri, 27 June 2008 05:05 Go to previous messageGo to next message
Eclipse UserFriend
Paul Levin <paul@apcl.us> writes:

> I have an Ant script (build.xml) that contains a few targets.
> I've added this file to the Ant Viewer, which lists the targets.
> I click on one of the targets and click the toolbar button on that
> viewer that looks like a green circle with a white arrow. The tool
> tip for this button says "Run the Selected Target".

Doing that works for me with my Ant build files.

> Each of my targets call <echo> and write something to a file.
> When I attempt to run the target as described above, nothing is
> written to the file. Thus it appears that Eclipse did not run the And
> script at all.

Whenever I run an Ant build like that Eclipse creates a new output in
the Console view with the usual Ant output (i.e. "Buildfile: ..." then
target names etc.). Are you getting that?

Also look at the external tools configuration/dialog a launcher should
have been created there for that build file. If it is there, check the
various entries to make sure there are no unexpected values,
especially for things like base directory.

--
Owen Rees; speaking personally, and not on behalf of HP.
========================================================
Hewlett-Packard Limited. Registered No: 690597 England
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Re: how do I run an Ant target from Eclipse?? [message #259453 is a reply to message #259348] Fri, 27 June 2008 16:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Darin,
Today I am getting a different behavior. No matter which target I
select in the Ant Viewer, when I click the Run Selected Target button,
the default target runs.

Note that I am talking about the Ant viewer, not a build launcher.

Yes, in the Debug view, it does show a terminated launch --

<terminated>projectName build.xml[simulate][Ant Build]

'build.xml' is the name of my Ant script and 'simulate' is the name
of the target I selected, but that target did not run. The default
target ran instead.

I also set a breakpoint on the targets in the Ant script. In the Ant
viewer I selected a target and selected "Debug As > Ant Build" from the
right mouse menu. The default target ran. The Ant script did not stop
in the debugger. I don't know if debugging Ant scripts is possible in
Eclipse. (Like it is in NetBeans.)

I'll also mention that I setup a Build launcher for my project, and
on the Targets tab I set the target for "During a Clean" to the 'clean'
target. When I then do Project > Clean the 'clean' target runs. So the
problem I'm having only applies to the Ant Viewer window, not to custom
launchers.

It is no longer too important to have this working, but if there is a
bug in Eclipse, some Eclipse developer should be made aware of it.

Thanks,
Paul



Darin Swanson wrote:
> Paul,
>
> I am unable to reproduce your problem....my target and/or buildfile runs
> just fine.
>
> If you go to the debug perspective and look in the debug view, are there any
> terminated launches showing up?
>
> And yes, I am running on Windows as well :-)
> Darins
> http://runnerwhocodes.blogspot.com
>
> "Paul Levin" <paul@apcl.us> wrote in message
> news:g3u5ib$cof$1@build.eclipse.org...
>> I have an Ant script (build.xml) that contains a few targets.
>> I've added this file to the Ant Viewer, which lists the targets.
>> I click on one of the targets and click the toolbar button on that viewer
>> that looks like a green circle with a white arrow. The tool tip for this
>> button says "Run the Selected Target".
>>
>> Each of my targets call <echo> and write something to a file.
>> When I attempt to run the target as described above, nothing is written to
>> the file. Thus it appears that Eclipse did not run the And script at all.
>>
>> Yet, if I open a cmd window (yes I'm running under Windows) and I run the
>> command "ant debug" (debug is the name of one of my targets) then it runs
>> as expected.
>>
>> So... how do I run an Ant target from Eclipse?
>>
>> Thanks,
>> Paul
>
>
Re: how do I run an Ant target from Eclipse?? [message #259458 is a reply to message #259369] Fri, 27 June 2008 16:36 Go to previous message
Eclipse UserFriend
Owen Rees wrote:
> Paul Levin <paul@apcl.us> writes:
>
>> I have an Ant script (build.xml) that contains a few targets.
>> I've added this file to the Ant Viewer, which lists the targets.
>> I click on one of the targets and click the toolbar button on that
>> viewer that looks like a green circle with a white arrow. The tool
>> tip for this button says "Run the Selected Target".
>
> Doing that works for me with my Ant build files.
>
>> Each of my targets call <echo> and write something to a file.
>> When I attempt to run the target as described above, nothing is
>> written to the file. Thus it appears that Eclipse did not run the And
>> script at all.
>
> Whenever I run an Ant build like that Eclipse creates a new output in
> the Console view with the usual Ant output (i.e. "Buildfile: ..." then
> target names etc.). Are you getting that?

Today I am, but no matter which target I select, it always runs the
default target. (Please the post I just made in response to Darin
Swanson, in this thread.)

>
> Also look at the external tools configuration/dialog a launcher should
> have been created there for that build file. If it is there, check the
> various entries to make sure there are no unexpected values,
> especially for things like base directory.
>

In Window > Preferences > Run/Debug > Launching > Default Launchers
there are no launchers lists.

In Projct > Properties > Builders, I do have a custom builder. The only
two things set for this builder are:
1) the Buildfile on the Main tab, and
2) on the Targets tab I set the 'clean' target for "During a Clean".
Both of these settings work.

What does not work is running the selected target from the Ant Viewer.

Thanks,
Paul
Previous Topic:CVS
Next Topic:can CVS work with SSH keys?
Goto Forum:
  


Current Time: Sun Nov 09 17:19:42 EST 2025

Powered by FUDForum. Page generated in 0.29418 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top