I am new to Renjin and cannot install packages with the AetherPackageLoader. I am getting the same error as in Renjin can't load pckages but with a seemingly correct Gradle file (please notice the a4Base dependency):
testCompile group: 'junit', name: 'junit', version: '4.12'
compile "org.renjin:renjin-script-engine:3.5-beta43";
// compile group: 'org.renjin.cran', name: 'e1071', version: '1.7-2-b1'
compile group: 'org.renjin', name: 'renjin-aether-package-loader', version: '0.8.1938'
compile "org.renjin.bioconductor:a4Base:1.27.0-b3"
The full error is:
18:08:35: Executing task 'PackageTest.main()'...
Starting Gradle Daemon...
Gradle Daemon started in 1 s 867 ms
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :PackageTest.main() FAILED
Using local repository: /Users/miguel/.m2/repository
Exception in thread "main" java.lang.RuntimeException: org.renjin.eval.EvalException: org.renjin.aether.AetherPackageLoader.load(Lorg/renjin/primitives/packaging/FqPackageName;)Ljava/util/Optional;
at org.renjin.eval.SessionBuilder.build(SessionBuilder.java:192)
at PackageTest.main(PackageTest.java:26)
Caused by: org.renjin.eval.EvalException: org.renjin.aether.AetherPackageLoader.load(Lorg/renjin/primitives/packaging/FqPackageName;)Ljava/util/Optional;
at org.renjin.sexp.Closure.applyPromised(Closure.java:212)
at org.renjin.sexp.Closure.apply(Closure.java:133)
at org.renjin.sexp.FunctionCall.eval(FunctionCall.java:80)
at org.renjin.eval.Context.evaluate(Context.java:282)
at org.renjin.eval.Context.evaluate(Context.java:209)
at org.renjin.eval.SessionBuilder.build(SessionBuilder.java:187)
... 1 more
Caused by: java.lang.AbstractMethodError: org.renjin.aether.AetherPackageLoader.load(Lorg/renjin/primitives/packaging/FqPackageName;)Ljava/util/Optional;
at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:152)
at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:130)
at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:114)
at org.renjin.primitives.packaging.Packages.library(Packages.java:39)
at org.renjin.primitives.R$primitive$library.doApply(R$primitive$library.java:68)
at org.renjin.primitives.R$primitive$library.applyPromised(R$primitive$library.java:33)
at org.renjin.sexp.BuiltinFunction.apply(BuiltinFunction.java:100)
at org.renjin.primitives.special.InternalFunction.apply(InternalFunction.java:46)
at org.renjin.sexp.FunctionCall.eval(FunctionCall.java:80)
at org.renjin.eval.Context.evaluate(Context.java:282)
at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:39)
at org.renjin.sexp.FunctionCall.eval(FunctionCall.java:80)
at org.renjin.sexp.Closure.applyPromised(Closure.java:200)
... 6 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':PackageTest.main()'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 48s
2 actionable tasks: 2 executed
18:09:24: Task execution finished 'PackageTest.main()'.
The example code only configures a session with an instance of AetherPackageLoader and try to execute an R command that loads a library that will need to be installed. The code fails sooner, when the session builder creates the session and loads the default packages.
AetherPackageLoader loader = new AetherPackageLoader();
loader.setRepositoryListener(new ConsoleRepositoryListener(System.out));
loader.setTransferListener(new ConsoleTransferListener(System.out));
Session session = new SessionBuilder()
.withDefaultPackages()
.setPackageLoader(loader)
.build();
RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();
RenjinScriptEngine engine = factory.getScriptEngine(session);
String code = "library('digest')";
SEXP sexp = (SEXP)engine.eval(code);
System.out.println(sexp);
I'd appreciate any help with AetherPackageLoader. I read the documentation and cannot tell what is missing. Thanks a lot, Miguel
EDIT: I cannot reproduce this error on a Windows PC. I believe this is related to other errors I am getting in RStudio since after the update to MacOS Catalina. I think there is a problem with the permissions after the update.
如果您将依赖项包含在 gradle 文件中,那么这些库将在类路径中可用,并且无需使用 AetherPackageLoader。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.