opening multiple intellij modules in the same project and remembering them on reopen

This is the number one problem that has prevented me from using IntelliJ more and I finally know how to do it. (I’ve known how to open multiple modules for over a year. What I learned yesterday at the IntelliJ 20th anniversary conference was how to reopen that same set)

Note about terminology to Eclipse users

If your primary IDE is Eclipse, keep this difference in terminology in mind as you read this.

EclipseIntelliJ
WorkspaceProject
ProjectModule

Step 1: Create a dummy/grouping project

Create a new project. This project’s purpose is to contain the modules you want together and give it a distinct name. I’ve been keeping them in an IntelliJ folder in my home directory to avoid confusion. (Most of my stuff is under the git folder in my home directory). The idea of keeping them separate is so I know there’s not code in there.

Step 2: Add your modules

There are several ways of adding modules. Any of them are fine. I find the fastest for repeated adds is:

  • File > Project Structure > Modules
  • Click “+”
  • Choose “Import module”
  • Navigate to the build file (ex pom.xml) or .iml file for generic projects

Step 3: Rename the project (if needed)

On rare occasions, I noticed the project name got my first module name. I couldn’t reproduce this, but started double checking. This name is what will show up in your recents list.

  • File > Project Structure > Project
  • Enter a new name if needed

Testing

File > Open Recents and open another project. Then File > Open Recents and open this project. Admire how all your modules are back!

Seeing the modules on disk for the curious

In the dummy project, the .idea directory has a misc.xml file. I was told it contains all the modules. And it did when I tested on Windows

<list>
  <option value="$USER_HOME$/git/myProj/pom.xml" />
  <option value="$USER_HOME$/git/myProj2/pom.xml" />
</list>

When I tested on Mac, modules.xml had this info

<modules>
   <module fileurl="file://$USER_HOME$/git/myProj.xml" filepath="$USER_HOME$/git/myProj.xml" /> 
   <module fileurl="file://$USER_HOME$/git/myProj2.xml" filepath="$USER_HOME$/git/myProj2.xml" /> 

</modules>

And a note about “you are doing it wrong”

I am an Eclipse power user and an IntelliJ competent user. What holds me back is not using IntelliJ more at work because of not knowing how to do this. While I don’t want to replace my usage, I do want to be an IntelliJ power user and use Eclipse enough to not lose my skills! I think this is the thing that will do it!

When I’ve tried to find out how to add multiple modules and have them remembered multiple times in the past, I was told that I was “using IntelliJ wrong” and should have one project that I focus on. (I work on many sets of small related projects; that model doesn’t work for me.)

Yesterday, someone attempted to tell me that I should have one big project that I focus on at a time. (aka my problem doesn’t exist.) After explaining what I do, another user said he does that I do. The first user said something about religion. That seems like just it. There’s multiple religions. It’s fine to be passionate and a true believer in yours. But as part of society, accepting that other people believe differently is part of life.

virtual scavenger hunt

Today at work, my team did a virtual scavenger hunt. I got the idea online, but I don’t remember where. What we did

Make the list

I had everyone post in the group chat one item to find. (I did this rather than making the list so I could play too!). We had:

  • a toy
  • toilet paper
  • a can of food
  • hand sanitizer
  • lysol
  • winnie the pooh
  • a book with exactly 8 words in the title
  • chocolate

Find items

Everyone then went off and got items. IT was fun int he video conference as people walked by with their stuff.

Show and tell

I then said each item and we held up what we had for that item. I combined hand sanitizer/lysol into one item. We chatted about some items. It was fun

In conclusion

Today I had a work task to find toilet paper. How many people can say that?

github – one of your dependencies has a security vulnerability

Yesterday, I committed a new project to github. I wasn’t paying attention and made a (mental) typo in typing the jackson-databind version number. I typed 2.2.3 instead of 2.10.3. The former is an old version with security vulnerabilities.

This meant I got to try out a new feature I had only read about – github informing you about the security issue in a dependency. Looking at the repo, I saw a nice yellow box – “We found potential security vulnerabilities in your dependencies. Only the owner of this repository can see this message”

GitHub also created a pull request offering to “Bump jackson-databind from 2.2.3 to 2.9.10.3”. I chose not to accept the pull request and choose the later version I intended – 2.10.3.

After pushing that change, the yellow box went away. GitHub even noticed that I updated the pom.xml and closed the pull request with the message “Looks like com.fasterxml.jackson.core:jackson-databind is up-to-date now, so this is no longer needed.”.

I then went into my gmail and deleted the 18 emails with the subject “One of your dependencies has a security vulnerability.” All of these emails arrived within two hours after I committed. That’s way too many notifications!