Yair's Tweaks & Tricks

Mainly software

Intellij Tips

2 Comments

As I am using Intellij for my daily software development work, I thought I’d share some useful tips.

Tip #1 – SCM Shortcut

quick access to SCM (Source Control commands) – Alt + `

 

Tip #2 – Branch management

If you want to hold multiple modules in the same project that have the same maven artifact id – you don’t have to open a new project.

Make sure the branch modules have a unique fie system folder name. I.e. module ‘foo’ is in ‘foo’ folder in trunk, but in branch the folder name is ‘foo-branch’. In this case you can import the branch module and have it side by side with the trunk module.

Note: you may want to update the ‘name’ in the pom.xml so you can easily distinguish between trunk and branch modules in the ‘Maven Project’ tab.

 

Tip #3 – module grouping

In case you want to group some modules together (very useful when managing trunk and branch together) you can right click on a module and choose ‘Move module to group’.

 

Tip#4 – Setting Module Dir as default working directory

Go to ‘edit configurations’ and under defaults define ‘$MODULE_DIR$’ as the working directory:

intellij default configurations

Naturally repeat this for Junit and and any other run type you wish.

 

Tip#5 – Dependencies Tree

Although dependencies graph exist only in the commercial edition you don’t really need them. You can see the full tree in the ‘Maven Project’ tab. If you want to understand how the maven resolution was done and why (maybe) you see the “wrong” version – you should install the “Maven Helper” plugin (just search for it the plugin repositories within Intellij) that will add another tab when you open your pom.xml file and you will see which version was omitted because of conflict (similar to the maven plugin supported in Eclipse).
Thanks to Izek Greenfield for this tip.

 

Tip #6 – Expand Tree Node

Know those times you need to expand all but only under the context you are currently focused (i.e. in ‘Maven Project’ expand all dependencies)?

Well, Ctrl + ‘+’ expands the whole tree and not only the specific node. BUT – use the numpad ‘*’ and there you have it. 🙂

Advertisements

2 thoughts on “Intellij Tips

  1. Very useful. Thanks for sharing!

  2. Thanks Yair.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s