OpenIE 4.2 - 无法使用sbt

时间:2016-02-01 19:26:11

标签: java scala sbt sbt-assembly information-extraction

我试图从华盛顿的 Knowitall 项目中生成OpenIE工具的独立.jar,如this Github page中所述,使用以下命令:

sbt clean compile assembly

但过了一会儿就停了,没有任何错误。 我可以执行sbt clean compile,但sbt assembly不起作用。 运行sbt assembly

时的输出如下
$ sbt assembly
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option
MaxPermSize=384m; support was removed in 8.0
[info] Loading project definition from /Users/john/Desktop/Tese/OPENIE/OpenIE 4/openie-master/project
[info] Set current project to openie (in build file:/Users/raposo/Desktop/Tese/OPENIE/OpenIE%204/openie-master/)
[info] Compiling 1 Scala source to /Users/john/Desktop/Tese/OPENIE/OpenIE 4/openie-master/target/scala-2.10/test-classes...
[info] Including: jetty-servlet-7.6.9.v20130131.jar
[info] Including: srlie_2.10-1.0.3.jar
[info] Including: jetty-security-7.6.9.v20130131.jar
[info] Including: breeze-math_2.10-0.2.jar
[info] Including: jetty-server-7.6.9.v20130131.jar
[info] Including: scala-library-2.10.3.jar
[info] Including: javax.servlet-2.5.0.v201103041518.jar
[info] Including: jetty-continuation-7.6.9.v20130131.jar
[info] Including: jetty-http-7.6.9.v20130131.jar
[info] Including: jetty-io-7.6.9.v20130131.jar
[info] Including: common-scala_2.10-1.1.2.jar
[info] Including: scopt_2.10-2.1.0.jar
[info] Including: breeze-core_2.10-0.2.jar
[info] Including: clearnlp-2.0.2.jar
[info] Including: paranamer-2.2.jar
[info] Including: netlib-java-0.9.3.jar
[info] Including: args4j-2.0.23.jar
[info] Including: arpack_combined_all-0.1.jar
[info] Including: log4j-1.2.17.jar
[info] Including: jregex-1.2_01.jar
[info] Including: hppc-0.5.2.jar
[info] Including: jblas-1.2.1.jar
[info] Including: breeze-learn_2.10-0.2.jar
[info] Including: clearnlp-dictionary-1.0.jar
[info] Including: clearnlp-general-en-pos-1.1.jar
[info] Including: nlptools-srl-clear_2.10-2.4.5.jar
[info] Including: nlptools-parse-clear_2.10-2.4.5.jar
[info] Including: nlptools-postag-clear_2.10-2.4.5.jar
[info] Including: nlptools-tokenize-clear_2.10-2.4.5.jar
[info] Including: nlptools-core_2.10-2.4.5.jar
[info] Including: liblinear-1.8.jar
[info] Including: dispatch-core_2.10-0.11.0.jar
[info] Including: scalaz-core_2.10-7.0.3.jar
[info] Including: async-http-client-1.7.16.jar
[info] Including: netty-3.6.3.Final.jar
[info] Including: slf4j-api-1.7.5.jar
[info] Including: unfiltered-filter_2.10-0.7.0.jar
[info] Including: unfiltered_2.10-0.7.0.jar
[info] Including: commons-cli-1.2.jar
[info] Including: mallet-2.0.7.jar
[info] Including: unfiltered-util_2.10-0.7.0.jar
[info] Including: commons-codec-1.4.jar
[info] Including: unfiltered-jetty_2.10-0.7.0.jar
[info] Including: jetty-webapp-7.6.9.v20130131.jar
[info] Including: jetty-xml-7.6.9.v20130131.jar
[info] Including: jetty-util-7.6.9.v20130131.jar
[info] Including: openregex-scala_2.10-1.1.2.jar
[info] Including: bsh-2.0b4.jar
[info] Including: openregex-1.1.1.jar
[info] Including: jsr305-2.0.1.jar
[info] Including: trove4j-2.0.2.jar
[info] Including: guava-15.0.jar
[info] Including: mtj-0.9.14.jar
[info] Including: opennlp-tools-1.5.3.jar
[info] Including: opennlp-maxent-3.0.3.jar
[info] Including: junit-4.11.jar
[info] Including: hamcrest-core-1.3.jar
[info] Including: opennlp-postag-models-1.5.jar
[info] Including: reverb-core-1.4.3.jar
[info] OpenIESpecTest:
[info] Including: opennlp-chunk-models-1.5.jar
[info] Including: opennlp-tokenize-models-1.5.jar
[info] OpenIE
[info] Including: opennlp-sent-models-1.5.jar
[info] Including: nlptools-chunk-opennlp_2.10-2.4.5.jar
[info] Including: nlptools-postag-opennlp_2.10-2.4.5.jar
[info] Including: nlptools-tokenize-opennlp_2.10-2.4.5.jar
[info] Including: reverb-models-1.4.0.jar
[info] Including: nlptools-stem-morpha_2.10-2.4.5.jar
Loading feature templates.
Loading models.
[info] Including: morpha-stemmer-1.0.5.jar
[info] Including: scala-arm_2.10-1.3.jar
Loading lexica.
[info] Including: nlptools-sentence-opennlp_2.10-2.4.5.jar
[info] Including: common-java-2.0.2.jar
[info] Including: commons-lang-2.6.jar
[info] Including: logback-core-1.0.13.jar
[info] Including: logback-classic-1.0.13.jar
[info] Including: chunkedextractor_2.10-2.2.1.jar
Loading configuration.
Loading feature templates.
Loading models.
Loading feature templates.
Loading models.
Loading lexica.
Loading feature templates.
Loading models.
Loading feature templates.
Loading models.
Loading lexica.
Loading feature templates.
Loading models.
Loading lexica.
[info] - should instantiate and extract correctly
[info] Run completed in 3 minutes, 47 seconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.

它看起来好像一切都很好,但它只是停留在那里,没有完成,我无法在任何地方找到.jar。

我的java版本是:

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

此项目使用的SBT版本为[info] 0.13.0。 我是在运行OS X 10.10.5 Yosemite的Macbook pro中这样做的。

感谢您的帮助!

2 个答案:

答案 0 :(得分:2)

smothP's答案通常可以解决问题。记录一件事,记得改变project/build.properties中的“sbt.version”。原始版本是0.13.0,它在我的Mac OS 10.11上不起作用,即使我更改./project/plugins.sbt和./build.sbt。 Change the sbt.version to 0.13.12。然后就行了。

还有一件事,请记住添加额外的内存,如原始文档中所述。 sbt -J-Xmx2700M clean compile assembly

答案 1 :(得分:1)

最后我能够解决这个问题。如果其他人遇到这个问题,会发布回复。

首先,我选择了较新版本的sbt-assembly(0.14.3),将文件 openie-master / project / plugins.sbt 更改为:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.2")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8")
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1")

然后,我稍微调整了构建选项,主要是通过添加javaOptions来增加内存使用量,并更改一些已弃用的导入。 openie-master / build.sbt 的最终版本是这样的:

import NativePackagerKeys._
import sbt._
import Keys._

name := "openie"
organization := "edu.washington.cs.knowitall.openie"
crossScalaVersions := Seq("2.10.2")
scalaVersion <<= crossScalaVersions { (vs: Seq[String]) => vs.head }

resolvers += "Sonatype SNAPSHOTS" at "https://oss.sonatype.org/content/repositories/snapshots/"

libraryDependencies ++= Seq(
  // extractor components
  "edu.washington.cs.knowitall.srlie" %% "srlie" % "1.0.3",
  "edu.washington.cs.knowitall.chunkedextractor" %% "chunkedextractor" % "2.2.1",
  // for splitting sentences
  "edu.washington.cs.knowitall.nlptools" %% "nlptools-sentence-opennlp" % "2.4.5",
  // for remote components
  "net.databinder.dispatch" %% "dispatch-core" % "0.11.0",
  // resource management
  "com.jsuereth" %% "scala-arm" % "1.3",
  // logging
  "org.slf4j" % "slf4j-api" % "1.7.5",
  "ch.qos.logback" % "logback-core" % "1.0.13",
  "ch.qos.logback" % "logback-classic" % "1.0.13",
  "org.scalatest" % "scalatest_2.10" % "2.0.RC1" % "test",
  "commons-lang" % "commons-lang" % "2.6")

mainClass in assembly := Some("edu.knowitall.openie.OpenIECli")

scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation")

assemblyOption in assembly := (assemblyOption in assembly).value.copy(cacheUnzip = true)
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = true, includeDependency = true)
assemblyOption in assembly := (assemblyOption in assembly).value.copy(cacheOutput = false)

// custom options for high memory usage

javaOptions += "-J-XX:MaxMetaspaceSize=2G"
javaOptions += "-J-XX:+CMSClassUnloadingEnabled"
javaOptions += "-J-Xmx3G"
javaOptions += "-XX:+UseConcMarkSweepGC"

traceLevel in run := 0
fork in run := true

//test in assembly := {}
//fork in Test := true

connectInput in run := true // forward stdin/out to fork

licenses := Seq("Open IE Software License Agreement" -> url("https://raw.github.com/knowitall/openie/master/LICENSE"))
homepage := Some(url("https://github.com/knowitall/openie"))

publishMavenStyle := true
publishTo <<= version { (v: String) =>
  val nexus = "https://oss.sonatype.org/"
  if (v.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at nexus + "content/repositories/snapshots")
  else
    Some("releases"  at nexus + "service/local/staging/deploy/maven2")
}

pomExtra := (  <scm>
    <url>https://github.com/knowitall/openie</url>
    <connection>scm:git://github.com/knowitall/openie.git</connection>
<developerConnection>scm:git:git@github.com:knowitall/openie.git</developerConnection>
    <tag>HEAD</tag>
  </scm>
  <developers>
   <developer>
      <name>Michael Schmitz</name>
    </developer>
    <developer>
      <name>Bhadra Mani</name>
    </developer>
  </developers>)

packagerSettings
packageArchetype.java_application

mappings in Universal ++= Seq(
  file("README.md") -> "README.md",
  file("LICENSE") -> "LICENSE"
)

默认情况下, assemblyOption includeScala includeDependency 为true。他们在那里是因为我试图从JAR中取出一些最终为800Mb的东西,但是如果我拿走它就无法运行它。

相关问题