Is it possible to start/stop Tomcat with keyboard shortcuts in Eclipse?
I'm trying to w开发者_运维问答ork in Eclipse as much as possible without a mouse. I cannot find a key binding for starting and stopping servers quickly in Eclipse WTP (Web Tools Platform).
One way to start a server is to switch to the package explorer (Alt+Cmd+Q P), select the project (up/down arrows) and then the "debug on server"-key binding (Shift+Alt+D R on the Mac). But this requires way too many steps.
I found a method that reduces starting a server down to two keystrokes (after some easy initial setup).
the tl;dr: f11, enter.
you will likely need to do some setup to get this working:
Be sure you have a run/debug configuration defined for tomcat.
- Click the run menu at the top of the window
- Click Debug configurations...
- Choose Apache Tomcat from the menu on the left
- If there's not already a server defined there, click "new launch configuration" (top left) and choose the correct server from the select menu on the right pane (you must already have a tomcat server defined in your servers view)
save all that, go back to a file in your project and press f11 (First required keystroke).
- if you get an error message that says something "could not find any code that could be executed on a server", then you either messed up the first step, or possibly your server is already running.
a dialog will pop up, the top choice being "Run on Server". Press enter (this is the 2nd required keystroke)
If this is your first time, you'll see another dialog after this which asks you to choose a server. Choose the server you want to run it on (you probably only have one), and check "always use this server when running this project" and you'll bypass this window in the future.
tip: you'll quickly notice that as a bonus, it will open up a web browser pointed at your server. you can change which browser it uses in windows->preferences->general->web browser.
and then there you have it. two keystrokes to start your server - f11, enter.
stopping it is another story. i haven't found a good way other than clicking the stop icon in severs or console. if you do, let me know...
While I don't perform the same steps as you to run my projects, I have created custom key-bindings to navigate around the eclipse environment. If you go to Eclipse Preferences > General > Keys
, you will be able to map the majority of tasks to key-bindings that make the most sense to you.
One process you could perhaps follow is this:
- Open package explorer via shortcut
- Perform a 'Collapse All' on the tree (reduce vertical navigation in step 3)
- Up/Down to your project
- Run shift-alt-D, R to Debug on your server
If you have 'Link with Editor' turned on, when you go to edit a file again your tree will expand based on the context of your work.
CTRL+ALT+R to restart
CTL+ALT+S to stop
If u look in Help > Key assist (Ctrl+shift+L), You can see a shortcut named Tomcat start,stop. The shortcut is Ctrl+Alt+T by default.
精彩评论