Process resource after created by plugin
Answered
My plugin creates resource file in /src/main/resources/
using:
WriteCommandAction.runWriteCommandAction(project) {
val fileType = FileTypeManager.getInstance().getFileTypeByFileName(ioFile.name)
val newFile = PsiFileFactory.getInstance(project).createFileFromText(ioFile.name, fileType, content)
parentPsiDir.add(newFile)
}
That file is at some point of time copied to target/classes
by IntelliJ automatically.
How can I trigger that compile/copy/process-resource action right after creating file?
Please sign in to leave a comment.
Hi Marcin,
What do you mean by “That file is at some point of time copied to
target/classes
by IntelliJ automatically”.I would expect that resources are copied to target by the build system (Maven, Gradle, etc.), not IntelliJ. Also, it sounds like a strange use case to copy resources from sources to the target directory automatically by the plugin. It sounds like a task for the build system.
In my case problem was that async refresh was not refreshing `target/` in proper time and thats why I was noticing changes “after some time”, after doing such:
Resource file is present in target.
Case closed, thanks