0

我尝试使用 sbt 将 jep 的构建(https://mvnrepository.com/artifact/jep/jep/2.24)包含到这个 scala 项目中:https ://github.com/shadaj/scalapy

因此,我不想通过非托管依赖项手动构建 jep,而是将其作为托管依赖项包含在内。因此,我只包括:

resolvers += "jep" at "https://mvnrepository.com/artifact/"

libraryDependencies += "jep" % "jep" % "2.24" 

在 build.sbt

.jar 正在下载并包含在我的 .ivy2 文件夹中,但是在编译时,sbt 似乎找不到它:

  > compile
[info] Updating {file:/C:/scalapy_indp/scalapy/}scalapy...
[info] Resolving org.sonatype.oss#oss-parent;9 ...
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.1/scala-library-2.12.1.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-library;2.12.1!scala-library.jar (1406ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.1/scala-reflect-2.12.1.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-reflect;2.12.1!scala-reflect.jar (1156ms)
[info] downloading https://repo1.maven.org/maven2/jep/jep/2.24/jep-2.24.jar ...
[info]  [SUCCESSFUL ] jep#jep;2.24!jep.jar (188ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.1/scala-compiler-2.12.1.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-compiler;2.12.1!scala-compiler.jar (2469ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.6/scala-xml_2.12-1.0.6.jar ...
[info]  [SUCCESSFUL ] org.scala-lang.modules#scala-xml_2.12;1.0.6!scala-xml_2.12.jar(bundle) (360ms)
[info] downloading https://repo1.maven.org/maven2/jline/jline/2.14.1/jline-2.14.1.jar ...
[info]  [SUCCESSFUL ] jline#jline;2.14.1!jline.jar (250ms)
[info] Done updating.
[info] Compiling 16 Scala sources to C:\scalapy_indp\scalapy\target\scala-2.12\classes...
[info] 'compiler-interface' not yet compiled for Scala 2.12.1. Compiling...
[info]   Compilation completed in 15.285 s
[error] C:\scalapy_indp\scalapy\src\gen\scala\me\shadaj\scalapy\py\ObjectTupleReaders.scala:2: not found: object jep
[error] import jep.Jep
[error]        ^

当然,代码中每次出现 Jep 都会出现错误。

我绝对不熟悉 scala 或 sbt,我只是想让它运行而不必使用非托管依赖项,即让它独立于平台。手动构建 jep 似乎取决于正在创建的文件的平台:

如果构建成功,它将创建一个目录 jep/build,其中将包含一个 jep.jar 和已编译的 Jep C 库,通常命名为 jep.so 或 jep.dll,具体取决于您的平台。

https://github.com/mrj0/jep/wiki/Getting-Started

4

1 回答 1

0

依赖项设置正确,但导入错误。

尝试

import org.nfunk.jep.JEP

反而。

--

实际上,我刚刚意识到这可能是两个不同的项目。您包含的依赖项是这个:http ://sens.cse.msu.edu/Software/jep-2.23/doc/website/doc/doc_usage.htm

于 2017-05-07T14:58:38.780 回答