Mark folder as source or test root
已回答
Hi, I am new on these topics, but I should write a plugin which listen on file changes (already done with success) and set a specific folder as source or test root, based upon on a set of rules.
What's the API to mark a folder as source or test root as can be done by the IDE UI?
Thank you so much!
Antonio
请先登录再写评论。
Hi Antonio,
You can use the same approach as mentioned in this comment:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206116979-How-to-set-Sources-Root-directory-and-Test-Sources-Root-directory?page=1#community_comment_206125705
Here you can find more information about content and source roots:
https://plugins.jetbrains.com/docs/intellij/module.html
Thank you so much Karol Lewandowski, I am going to try it..
It worked as expected, thank you!
I published my plugin at https://plugins.jetbrains.com/plugin/18410-maven-templating-for-ij/ .
Unfortunately now I have a new issue which not prevents it from working, but it logs a boring exception into IntelliJ log:
It happens because I manipulate source roots into a virtual file system before event.
How can I prevent it?
Is there a way provided by the plugin to defer the execution of my methods after the before event exited?
Thank you so much in advance.