0
我想打包一個非託管jar以及一些Scala代碼。我使用IntelliJ編程,我不確定包是否正確構建。這是build.sbt包裝好嗎?
我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將被轉換爲.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$")
我不希望jar有一個主要方法,我希望它是一個lib,就是這樣。通過提取生成的jar的內容,似乎所有的依賴關係都被添加了。那麼問題依然是爲什麼ikvmc無法將其轉換爲dll。謝謝,至少看起來我的感覺沒問題。 :) – Marin
@Marin樂於幫忙!請記住點贊和/或接受幫助您找到解決方案的答案,或闡明這種情況。通過這樣做,人們將來會更有可能幫助你!我還會更新您的原始文章,並提供您收到的警告,因爲它可能會提供更多線索,讓我們爲您提供幫助。 –