The most common build activity I do in Eclipse (other than allowing auto-build to do its thing) is to perform a "Maven Build..." with parameters of clean and package. This runs all my tests. m2eclipse does a great job with this, and I like the output. If a test breaks, I then jump to using the JUnit plug-in, the debugger, etc.
I've used "Organize favorites..." under the Run (and Debug) button's drop down menu to make this kind of build "permanent" and somewhat easy to access and use.
But not easy enough.
What I have now is a button that morphs from moment to moment, based on my last activity, what file I have open, or what item I have selected in the project window. Yes, I can click the down-arrow next to the run button, select the favorite for "clean-and-package" but for something that I do hundreds of times a day, that's too difficult.
I want ONE BUTTON. A big ol' button on the tool bar that I just click and boom goes the dynamite. I'll also accept a way of assigning a hot key to my build favorite so I can press, say, ctrl+r or something to run my favorite item.
What'cha got for me?
If you create a Maven Run Configuration and put a number as the first character in the name, then you can use Shift-Alt-X Ctrl-M N, where N is the number you gave as first character in the name. For your case, do the following.
I've rediscovered key bindings in Eclipse. It's not exactly what I want, but it works well enough, I suppose. I simply bind F7 to Maven's test hook. It's not the same as "
mvn clean package
" but it'll do until I find a better solution.Here's how I did it:
Now, when you press F7, eclipse will run "
mvn test
".For whatever reason, and I'm sure it's a perfectly good one, the m2eclipse plugin authors didn't provide a "Run Maven package" hook. Sigh.
It looks like there's a couple of ways to do this - none directly in Eclipse: