Bind key to specific Ant target [message #240437] |
Mon, 12 November 2007 13:27  |
Eclipse User |
|
|
|
Originally posted by: lists.sauyet.com
Is there any way to bind a key sequence to run a particular Ant target?
I'm pretty new to Eclipse (and may at any time bolt back to the safety
of my preferred text editor! ;-) ) but would love to have some of the
facilities of a modern IDE. So I'm trying, I really am. One
frustration is that in my editor I can easily bind keystrokes to
arbitrary commands, but I haven't been able to figure out how to do so
in Eclipse or Netbeans. For instance, CTRL-5 runs the command
ant -emacs -find build.xml clean
in the directory of the current file. CTRL-6 does a compile. CTRL-7
prompts for the name of a target and then runs
ant -emacs -find build.xml <target-name>
I use shortcuts like these all the time, and would rather not have to go
to the mouse to run them. Many of them work for me because I have
fairly standard build files for my Java projects, but the last one lets
me run any target in the build script and it remembers my recent ones,
offering autocomplete suggestions as well so I don't have to type the
whole name.
Is there a simple way to do this in Eclipse? I can see how to bind
keystrokes in Window > Preferences > General > Keys, but there doesn't
seem to be any way to do more than the basic commands built into
Eclipse. Am I missing something?
Thanks,
-- Scott
|
|
|
|
Re: Bind key to specific Ant target [message #240573 is a reply to message #240507] |
Tue, 13 November 2007 14:21  |
Eclipse User |
|
|
|
Originally posted by: lists.sauyet.com
Felix Dorner wrote:
> I don´ t know whether it´ s possible to run an arbitrary system command
> from eclipse.
Although that would duplicate how I do it from my text editor, I don't
really need that; in fact I want to invoke Ant using the IDE's tools.
What I would like is a way to assign keystrokes that will call specific
Ant targets in the build for the project holding the file I'm currently
editing. This will work for me because every build has "clean",
"compile", and "test" targets. Many have "jar", "war", or "deploy"
targets as well.
> Regarding ant build files I guess you already have read
>
> http://help.eclipse.org/help33/topic/org.eclipse.platform.do c.user/gettingStarted/qs-85_ant_configs.htm
No, I hadn't run across it. It looks useful, but I think it doesn't
quite do what I'd like. First, I don't see how to connect this up to a
keystroke. Window > Preferences > General > Keys seems to list a fixed
set of commands that I can pick from and the newly created entry in the
Run > External Tools menu isn't on the list. Second, even if it did,
this would be specific to the project. I would really like a means to
do this based upon the file I'm editing. If I'm in the middle of
editing a file in Project A, I'd like a quick keystroke that will run
the "compile" task in the ant script for A. But if I'm in Project B
instead, I want that same keystroke to run the "compile" task in the
script for B.
>
> This way you would create a "launch configuration", then Run... is
> certainly available through a shortcut, and you´d just select the
> configuration to launch.
How could I make this available through a shortcut, or are you talking
about the shortcuts for the menus (on my Win32 machine that would be
ALT-R > E > 1 for the just-created configured run of Ant)?
Thanks for the suggestion, and I'll keep plugging away to see if I can
get it to work.
-- Scott
|
|
|
Powered by
FUDForum. Page generated in 0.09983 seconds