Intellij idea IntelliJ-如何获取模块的类路径

Intellij idea IntelliJ-如何获取模块的类路径,intellij-idea,Intellij Idea,我是IntelliJ的新手,正在从事一个包含数百个模块的大型项目,我只是想知道如何获得特定模块的类路径 这可能会对你有所帮助。因为每个模块都有自己独立的类路径。您可以组合项目中所有模块的类路径,这就是该方法所做的,但是尝试使用该类路径不太可能在多模块项目中产生正确的行为 public static String getFullClassPath(Module m){ String cp = ""; cp += CompilerPaths.getModuleOutputPath(m,false);

我是IntelliJ的新手,正在从事一个包含数百个模块的大型项目,我只是想知道如何获得特定模块的类路径

这可能会对你有所帮助。因为每个模块都有自己独立的类路径。您可以组合项目中所有模块的类路径,这就是该方法所做的,但是尝试使用该类路径不太可能在多模块项目中产生正确的行为

public static String getFullClassPath(Module m){
String cp = "";
cp += CompilerPaths.getModuleOutputPath(m,false);

for(VirtualFile vf : OrderEnumerator.orderEntries(m).recursively().getClassesRoots()){
    String entry = new File(vf.getPath()).getAbsolutePath();
    if(entry.endsWith("!/")){ //not sure why it happens in the returned paths
        entry = entry.substring(0,entry.length()-2);
    }
    if(entry.endsWith("!")){
        entry = entry.substring(0,entry.length()-1);
    }
    cp += File.pathSeparator + entry;
}
return cp;

}

您想解决什么问题?你为什么需要它?它的形式是什么?