OpenIE 4.2 - Невозможно сгенерировать автономный.jar с использованием sbt

Я пытаюсь сгенерировать автономный.jar инструмента OpenIE из Вашингтонского проекта Knowitall, как описано на этой странице Github, с помощью команды:

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, Я делаю это в MacBook Pro под управлением OS X 10.10.5 Yosemite.

Спасибо за любую помощь!

2 ответа

Решение

Наконец я смог решить это. Будет опубликован ответ, если кто-то столкнется с этой проблемой.

Сначала я выбрал более новую версию 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, но я не смог запустить его, если бы взял.

smothP's Ответ, как правило, решает проблему. Одна вещь для записи, не забудьте изменить "sbt.version" в project/build.properties, Исходная версия 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,

Другие вопросы по тегам