Create resources root in a module and add new file

Answered

I need to add a special resources file to a user project (for example, MockMaker file from this tutorial https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#39)  

So I have an instance of test module (com.intellij.openapi.module) and I need:

- to create test resources root if not exists

- mark it as test resources root

- add a file to this test resources root

What is a best way to do it?

0
1 comment

Hi Egor,

You may be interested in the following APIs:

  • Standard Java java.io.File API for creating new files
  • ModuleRootManager and related classes/methods mentioned in this comment for manipulating source roots
0

Please sign in to leave a comment.