Programatically get Compiler output for project

Greetings

I was wondering how to find the project specific path to find the compiled class for a java file from an action

I am easily able to get the file

VirtualFile selectedFile(AnActionEvent e)
{
return (VirtualFile) e.getDataContext().getData(DataKeys.VIRTUAL_FILE.getName());
}
I can see that the project root can be found at

ProjectRootManager.getInstance(current_project).getContentRoots();

And I could assume that the class will be in out/production above this folder.

However, the project compiler output is actually configurable from within project structure.

Is there a setting I can read what the project output path is?

Further to my research on this matter, it may be that the java file is inside a module, and different modules have different output paths. So I need to find what module I am in from the action, and then where the class file is generated for that file.

I was also wondering, ist it possible to attach a listener to somewhere to fine out when a compilation has occurred?

 

Thanks

 

0

Please sign in to leave a comment.