2

I'm hoping someone can help me with this issue my team is currently facing. We currently have IntelliJ files checked into our git repo. The iml files are annoying to see in the git staging area. We are trying to do the following:

  1. Remove IML files from git
  2. Persist the codeStyleSettings.xml and all the config files in .idea/runConfigurations in git
  3. Switch between branches and NOT having to re-import / re-sync maven.

We are able to execute criteria 1 and 2 without any issues, but 3 is giving us a hard time. It seems like IntelliJ requires us to manually re-import the maven each time we switch branches. Sometimes IntelliJ wouldn't even recognize that the pom.xml. When we still had the IML files in repo, we never had any problems with maven when switching between branches. So I'm curious if anyone has any ideas or suggestions on how to resolve this dilemma? Any input is greatly appreciated!

I've search and found this to be the closest Q&A to my problem, but it didn't satisfied our 3 criterias. How to deal with IntelliJ IDEA project files under Git source control constantly changing?

I also know about https://www.gitignore.io/ but it only provides the basic ignores for IntelliJ and Maven.

Community
  • 1
  • 1
DR3AMR2
  • 31
  • 3
  • Based on your description you title is wrong...Intellij seemed to be the problem and not Maven... – khmarbaise May 04 '16 at 07:08
  • Thanks for the comment @khmarbaise I edited the title to reflect IntelliJ. – DR3AMR2 May 04 '16 at 16:03
  • IDEA has a "Import Maven projects automatically" option, consult with IDEA help – kan May 04 '16 at 16:22
  • @kan I already tried that option with the import maven project automatically. It works about 25% of the time. Other times it doesn't even recognize itself as a maven project. I also consulted them for help here: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems?page=2#comment_201188005 – DR3AMR2 May 04 '16 at 16:37
  • It works fine for me, seems you are doing something wrong. Delete all idea project files from repository and add them into .gitignore. Then open pom.xml as project, so IDEA does import. – kan May 04 '16 at 16:40
  • So you're able to switch branches constantly without losing the maven settings? Opening the pom.xml always works for me. It's when I already have the project open and I switch to a different branch is where the maven setting goes out. I would then have to manually refresh maven to have it re-index all the dependencies. – DR3AMR2 May 04 '16 at 16:51

0 Answers0