【发布时间】:2022-02-02 00:40:17
【问题描述】:
我正在尝试将非托管 jar 与一些 Scala 代码一起打包。我使用 IntelliJ 进行编程,但不确定是否正确构建了包。
我的build.sbt如下:
name := "InvokeCompiler"
version := "1.0"
scalaVersion := "2.11.8"
exportJars := true
val parserLocation = "lib/parser-0.0.1.jar"
mappings in (Compile, packageBin) ~= {
_.filter(!_._1.getName.startsWith("Main"))
}
//unmanagedJars in Compile += file(parserLocation)
mappings in (Compile, packageBin) <+= baseDirectory map { base =>
(base / parserLocation) -> "parser-0.0.1.jar"
}
我想创建一个新的 jar 文件,其中包含非托管 jar 和我编写的代码。这个 jar 将被转换为 .dll 以便在 C# 中使用。但是,当这样做时,IKVMC 会抛出各种警告。当我添加 .dll 时,它会生成 .dll 只包含我自己编写的类。
编辑: 阅读福特先生的评论后,以下是我在生成的 jar 上运行 ikvmc 得到的警告和错误:
PROMPT:> ikvmc -target:library compiled.jar
IKVM.NET Compiler version 7.2.4630.5
Copyright (C) 2002-2012 Jeroen Frijters
http://www.ikvm.net/
note IKVMC0002: Output file is "compiled.dll"
warning IKVMC0100: Class "org.nlogo.core.FrontEndInterface" not found
warning IKVMC0100: Class "scala.Tuple2" not found
warning IKVMC0100: Class "scala.reflect.ScalaSignature" not found
warning IKVMC0100: Class "scala.Option" not found
warning IKVMC0100: Class "org.nlogo.core.Program" not found
warning IKVMC0100: Class "scala.collection.immutable.ListMap" not found
warning IKVMC0100: Class "org.nlogo.core.ExtensionManager" not found
warning IKVMC0100: Class "org.nlogo.core.CompilationEnvironment" not found
warning IKVMC0100: Class "org.nlogo.core.Femto$" not found
warning IKVMC0111: Emitted java.lang.NoClassDefFoundError in "Interface.ASTSingleton$.getFrontEndCompiledAsJSON(Ljava.lang.String;)Lscala.Tuple2;"
("org.nlogo.core.FrontEndInterface")
warning IKVMC0111: Emitted java.lang.NoClassDefFoundError in "Interface.ASTSingleton$.getFrontEndSingletion()Lorg.nlogo.core.FrontEndInterface;"
("org.nlogo.core.Femto$")
【问题讨论】: