在 INRIA SPOON 中没有所有依赖项的处理

Processing without all dependencies in INRIA SPOON

我想处理一个 class,我无法解决它的所有依赖关系,我收到以下错误:

Exception in thread "main" spoon.compiler.ModelBuildingException: The import org.apache.commons cannot be resolved at /home/elmarce/PROJECTS/DATA/SOURCE/openimaj-master/core/core-image/src/main/java/org/openimaj/image/ImageUtilities.java:55
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.report(JDTBasedSpoonCompiler.java:665)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblems(JDTBasedSpoonCompiler.java:646)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:127)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:108)
    at spoon.Launcher.buildModel(Launcher.java:703)
    at fr.inria.diversify.syringe.SyringeInstrumenterImpl.instrument(SyringeInstrumenterImpl.java:147)
    at fr.inria.heavyloops.Main.main(Main.java:114)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

我想我记得在以前的 Spoon 版本中,使用 env.useSourceCodeFragments(true); 可以做到这一点,但在 Spoon 5.2 中我不知道如何做到这一点。

您应该使用无类路径模式:

spoon.getEnvironment().setNoClasspath(true);