Failing to Add OpenMRS Code Templates in intellij Idea

Hey devs, am new to linux os! I want to import openmrs live tamplates into IntellijIdea settings but am failing to locate the directory where IntellijIdea file tamplates are stored. Have carefully followed Developer How-To Setup And Use IntelliJ. Can any one help
cc: @rakshir, @herbert24, @jwnasambu, @mozzy

1 Like

have you followed and looked at( Add OpenMRS Code Templates) section in the above link very well !!

@herbert24, I followed it carefully. When I navigate to ~IntelliJ IDEA/config directory, am not able to see tamplate folder. I wonder if this could not be related to something like a file extension issue that intellij is not understanding on linux

You might have accidentally edited the template in File and Code Template. To be successful revert it to its previous state.

I opted Eclipse IDE and it has worked fine. The error in intellij could have been caused by file extension issue since I was using a trial version of Intellij.

Just adding a solution which might be helpful for people facing a similar issue.

I use Ubuntu 20.04 and was facing the same issue with the template directory. For me, copying the templates.xml file to ~/.config/JetBrains/IdeaIC<version>/templates/ directory worked out. Actually, there was no <path>/templates/ directory initially, so I had to create one.

~/.config/JetBrains/IdeaIC<version> is basically the default directory where IntelliJ IDEA stores its settings. It’s also mentioned in the Install-Linux-tar.txt file which comes along with the distribution.


I faced the same issue on windows. I resolved it by

  1. Open IntelliJ
  2. Goto File > Settings > Live templates.
  3. Click on the plus sign and click Template Group there.
  4. Save the Group name as ‘OpenMRS’ then create a dummy template for that group.
  5. Now Click ‘Apply’ and ‘ok’ and exit the IDE.
  6. Goto %AppData% in your Windows File Explorer.
  7. Open ‘JetBrains’ Folder.
  8. Open ‘IdeaIC2020.3’ Folder.
  9. There you will find ‘templates’ folder which was created because you created ‘OpenMRS’ template group and dummy template.
  10. Inside that folder you find ‘OpenMRS.xml’ File.
  11. Replace that file with templates.xml file given in the developer guide.
  12. Make sure that the file name is same i.e. ‘OpenMRS.xml’.
  13. Now reopen your IntelliJ IDE and go to Live Templates, you will see OpenMRS templates there.

@abhishek thanks for sharing your solution here so as to help others

1 Like