Boost your productiveness with these 4 IntelliJ tips

Rafael AS Martins
5 min readJul 4, 2020
Photo by Isaac Smith on Unsplash

“I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do It“. — Bill Gates

This quote is quite what we, as developers are always looking for — an easy way to achieve what we want — and nothing better than shortcuts with the same outcome.

With these 4 tips, you will find yourself more available to think about the real problem instead of getting stuck on the usual “how to get there” problem.

# Tip 1: Create your Live Templates

For those who don’t know what live templates are about, it’s mostly about what autocomplete recommendations our IDE gives us, like the famous ‘sys’ in Eclipse, which gives us the System.out.println method recommendation.

In Intellij you can create your live templates. The only limitation you have is your imagination. One great example to explain this one, is related to the previous recommendation example.

By default ‘sys’ doesn’t exist on IntelliJ, its synonym here is ‘soutp’. When transitioning from Eclipse to IntelliJ, this difference was odd and it was a tough time to get used to it.

That’s when I decided to create my template with the following steps:

  1. Get Into your IntelliJ Preferences > Search for ‘Live Templates’ > Select ‘Output
Preferences

2. Click on the ‘+’ icon on the right side > Live template

Note: The option will expand and show something like this:

Live Template Setup

3. Then fill it up with this info:

Live Template Setup

4. Apply the changes and let’s try it:

Live Template Setup Result

Nice work! Now with this example, you’re on your way to create your own live templates to better suit your context, in the laziest way possible.

# Tip 2: Create your deploy process

For those who work with Docker, my friends… this will be handy. As you’re probably used to, when running our application it’s about running at least 3 different commands.

We are not being lazy at all, and it’s time to fix that. In this case, I’ll show you a simple example of how to start a Docker application with a build profile execution with only one click.

  1. Click on the dropdown on the right side of the hammer > “Edit Configurations…
Edit Configurations

2. Expand “Templates” > Expand “Docker” > “Docker-compose” > Create “Configuration”

Create Configuration

3. The following box should appear:

Create Configuration

Name: Insert your name project.

Server: Docker (Default).

Compose File: Click on the small folder icon to select your docker-compose.yml file.

Service (s): After you added the compose file by clicking on the small folder icon, all the services specific to that field should appear automatically.

In case you want to run, for example, a build command, with a certain maven profile, you can specify it on the “before launch” box:

Click on the “+” icon just below > Run “Maven Goal” > Write clean install -P <profile-example> > Press Ok

After this, click “Apply” and you’re all set! You’ve got yourself a build process with just one click, similar to this one:

Create Configuration

# Tip 3: Find Your REST Endpoint Easily

Most folks who implement REST APIs and try to place in their mind which controller has the correspondent endpoint responsibility, are not being lazy at all.
There are way more important things to place in our brain like the Shallow music of Lady Gaga…

  1. Open the Symbols interface (CMD+Alt+O for Mac or Ctrl+Alt+O for Windows) and write a simple slash ‘/
Available endpoints

2. Then you just need to click on your desired endpoint and Voilá!

# Tip 4: Get into your recent files from IntelliJ and not from your head

How many times have we closed a tab to save some space, or to clean up the interface ahead of us? After a long debug trail, sometimes it may be tough to remember the previous 6th class name we were working on. Then it’s a guessing game to try and find it.

IntelliJ does this for us just by pressing CMD + E or Ctrl + E (Called Recent files tab).

Recent Files

Conclusion

I hope these tips can help you improve your development process.

Jokes aside, we should optimize our time and start using all these functionalities our IDEs give us way more often.

IntelliJ is a great IDE and I’m sure that when you start using it you won’t want, nor need, anything else.

As mentioned before, I come from an Eclipse environment and I know what it is to be on the other side.

I’m not saying that Eclipse it’s a bad IDE. Not at all. It’s quite good. However, it’s these details that make an IDE a lot more special.

Feel free to leave a comment or chat with me on LinkedIn.

--

--

Rafael AS Martins

As a software engineer, creating good and reliable solutions is my everyday goal. Within my articles, I try to express all the excitement and passion around it!