how to get output path and test output path of a project?
I cannot find a method in Project or ProjetRootManager that could get the output paths or test output paths of a project. These paths can be set in project structure -> project settings -> Modules.
I think maybe the question is how to get the modules from a given project.
请先登录再写评论。
Please refer to our documentation about modules.
Thanks a lot for the information.
This call gets a list of paths:
VirtualFile[] roots = ModuleRootManager.getInstance(modules[i]).orderEntries().classes().getRoots();
But, it only contains test output paths with the name of "test-classes", but not the output path of the compiled classes of the module.
Hi, please help with the output path part? I didn't find the output path of a module.
I still can't retrieve this required information:
We need to get these paths, "Output path" and "Test output path", through some API calls.
Sorry for the delay. You can read these paths via CompilerModuleExtension class, I've just updated javadocs to make it more discoverable.
Thank you for the information.
We also found this API while going through the source code:
Is this the right way? Or should we use the CompilerModuleExtension class?
Also, which way will cover both "Inherit project compile output path" and "Use module compile output path" cases? Will these approach work with both Maven and Gradle projects?