我想处理一个类,我不能解决所有的依赖关系,我得到以下错误:
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中,我不知道如何做到这一点。
您应该使用noclasspath模式:
spoon.getEnvironment().setNoClasspath(true);