Maven support: adding deps to the POM

Is there a way (or a plugin that does this) to get a context menu that helps me add my dependencies to my Maven project? For example, if I'm working on a project and decide I need to use some stuff from Commons Lang, I'm far too lazy to have to go look up what the exact group and artifact ids and current stable version is, and then edit the XML myself.

Sean

9 comments
Comment actions Permalink

Hello Sean,

Try pressing Alt-Ins in pom.xml.

Is there a way (or a plugin that does this) to get a context menu that
helps me add my dependencies to my Maven project? For example, if I'm
working on a project and decide I need to use some stuff from Commons
Lang, I'm far too lazy to have to go look up what the exact group and
artifact ids and current stable version is, and then edit the XML
myself.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Does nothing. I'm on a Mac, so I tried various combinations of command/option INS but again with no result. I did RTFM but I couldn't find anything covering this.

Cheers,

Sean

0
Comment actions Permalink

Hello Sean,

Does nothing. I'm on a Mac, so I tried various combinations of
command/option INS but again with no result. I did RTFM but I couldn't
find anything covering this.


The action is called Code | Generate..., and if I remember correctly the
Mac shortcut for it is ^N.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi Dmitry...

Command+N pop up a dialog asking for a class name. If I enter something, I can pick a class from a local or maven jar, and it takes me to the class declaration. This isn't what I was after.

I just found the plugins manager, and so I'm like a kid in a candy store. Maybe I'll find something in there. :)

Cheers,

Sean

0
Comment actions Permalink

http://blogs.jetbrains.com/idea/2010/03/maven-generate-actions-for-pomxml-editor/

on a mac it is probably one of those "option(s)" keys instead of ALT key.

You can invoke it by, opening the pom.xml and:

1) CTRL + SHIFT + A,
2) type in:  "generate..."

Now you can see what shortcut it is (on linux it is alt+insert)

Or, if that doesn't work, through menu:
1) Search
2) Find action
3) type in:  "generate..."


Find action is your friend for finding actions by description. Install also "Key promoter" plugin while in the candy store...
cheers,
-m

0
Comment actions Permalink

Ah ha... that works, thanks! I think I prefer the way m2eclipse does it, but I might change my mind after I use this for a while.

Sean

0
Comment actions Permalink

hm, I don't know how myEclipse is doing it, but, what you need to do is to
figure out the right shortcut on your mac (alt+insert on linux/wintel),
I don't know how it can be any easier ..?

0
Comment actions Permalink

To clarify, m2eclipse is the maven plugin for Eclipse. MyEclipse is a (IMO) cruddy Eclipse-based IDE.

Anyway, you right click on the project, click on Maven->Add Dependency, select dependency+version, optionally set scope (this is very useful), and done. No need to navigate to and open the pom.xml, no need to re-import to get the dep in the classpath.

Sean

0
Comment actions Permalink

I see.
I believe you need pom.xml to be open in intellij. But I almost don't use mouse/clicking that much, thats why m2eclipse wouldn't work for me ;-)
Anyway, you can always file a request to add context menu in the maven view for inserting deps.
cheers
-m

0

Please sign in to leave a comment.