1

我想使用 sbt-native-launcher 将 zip 文件发布到 bintray。

我能够执行:

sbt publish

它发布主要的工件(.jar、javadocs 等)。

我也能够执行:

sbt universal:packageBin

它会生成 .zip 文件。

但是,当我执行时:

sbt universal:publish

它给出了以下错误:

[info] Wrote C:\src\ShExcala\target\scala-2.10\shexcala_2.10-0.0.1.pom
tar: Cannot execute remote shell: No such file or directory
tar: C\:\\Users\\Labra\\AppData\\Local\\Temp\\sbt_407249ba\\shexcala-0.0.1.tar: Cannot open: I/O error
tar: Error is not recoverable: exiting now
[trace] Stack trace suppressed: run last universal:packageZipTarball for the full output.
[error] (universal:packageZipTarball) Error tarballing
C:\src\ShExcala\target\universal\shexcala-0.0.1.tgz. Exit code: 2

似乎问题出在“universal:packageZipTarball”任务上,它也给出了同样的错误。

我正在使用 Windows,并且我检查了我是否安装了“tar”、“xz”和“gzip”。

我现在不介意只发布 .zip,所以也许另一种解决方法就是知道如何配置 sbt-native-packager 以避免 packageZipTarball 任务。

build.sbt 定义是:

import sbt._
import sbt.Keys._
import AssemblyKeys._
import bintray.Plugin.bintraySettings
import bintray.Keys._
import scala.scalajs.sbtplugin.ScalaJSPlugin.ScalaJSKeys._

lazy val root = project.in(file("."))//.settings(crossScalaVersions := Seq("2.10.4", "2.11.0"))

Build.sharedSettings

version := Build.currentVersion

libraryDependencies ++= Seq(
    "org.specs2" %% "specs2" % "2.3.7" % "test" 
  , "org.scalatest" % "scalatest_2.10" % "2.0.1-SNAP" % "test"
  , "commons-configuration" % "commons-configuration" % "1.7"
  , "org.rogach" %% "scallop" % "0.9.5" 
  , "com.typesafe" % "config" % "1.0.1"
  , "org.scala-lang" % "scala-compiler" % "2.10.2" 
  , "com.assembla.scala-incubator" % "graph-core_2.10" % "1.6.2"
  , "org.apache.jena" % "jena-arq" % "2.10.1" 
  , "org.scalaz" % "scalaz-core_2.10" % "7.0.6" 
  , "es.weso" % "stateparser_2.10" % "0.0.1"
  , "es.weso" % "wesin_2.10" % "0.0.1" 
  )

autoCompilerPlugins := true

seq(bintraySettings:_*)

Build.publishSettings

deploymentSettings

publishMavenStyle := true

// publish <<= publish.dependsOn(publish in config("universal"))

packageArchetype.java_application

resourceGenerators in Test += Def.task {
  val location = url("https://github.com/shexSpec/test-suite/raw/gh-pages/tests.zip")
  IO.unzipURL(location, resourceManaged.value / "downloadedTests").toSeq
}.taskValue

resolvers ++= Seq("snapshots", "releases").map(Resolver.sonatypeRepo)

project/build.scala

import sbt._
import sbt.Keys._
import bintray.Plugin.bintraySettings
import bintray.Keys._
import Def.ScopedKey
import scala.scalajs.sbtplugin.ScalaJSPlugin._

object Build extends sbt.Build {

  val isRelease = true 

  def repo = "weso-releases" 

  val shExcalaVersion = "0.0.1"

  publishMavenStyle := false

  val currentVersion = shExcalaVersion

  protected val bintrayPublishIvyStyle = settingKey[Boolean]("=== !publishMavenStyle")   

  lazy val publishSettings = Seq(
    repository in bintray := this.repo,
    bintrayOrganization in bintray := Some("weso"),
    licenses += ("MPL-2.0", url("http://opensource.org/licenses/MPL-2.0")),
    bintrayPublishIvyStyle := true
  )

 val sharedSettings = Seq(
    organization := "es.weso",
    name := "shExcala",
    scalaVersion := "2.10.4"
 )
} 

的输出last universal:packageZipTarball是:

> last universal:packageZipTarball
java.lang.RuntimeException: Error tarballing C:\src\ShExcala\target\universal\shexcala-0.0.1.tgz. Exit code: 2
        at scala.sys.package$.error(package.scala:27)
        at com.typesafe.sbt.packager.universal.Archives$$anonfun$makeTarball$1.apply(Archives.scala:134)
        at  com.typesafe.sbt.packager.universal.Archives$$anonfun$makeTarball$1.apply(Archives.scala:118)
        at sbt.IO$.withTemporaryDirectory(IO.scala:285)
        at com.typesafe.sbt.packager.universal.Archives$.makeTarball(Archives.scala:118)
        at com.typesafe.sbt.packager.universal.Archives$$anonfun$10.apply(Archives.scala:111)
        at com.typesafe.sbt.packager.universal.Archives$$anonfun$10.apply(Archives.scala:111)
        at scala.Function3$$anonfun$tupled$1.apply(Function3.scala:35)
        at scala.Function3$$anonfun$tupled$1.apply(Function3.scala:34)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
        at sbt.std.Transform$$anon$4.work(System.scala:64)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
        at sbt.Execute.work(Execute.scala:244)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
[error] (universal:packageZipTarball) Error tarballing     C:\src\ShExcala\target\universal\shexcala-0.0.1.tgz. Exit code: 2
>
4

1 回答 1

3

我认为问题出在tarfor windows 上,它不接受绝对路径。sbt -native-packager所做的是执行tar -pcvf <absolute-path> <input>.

我不确定您是否可以轻松禁用universal:packageZipTarball任务。

我可以提出一个解决方法。安装bsdtar,它似乎没有这个问题,仍然可以称为 gnu tar。从链接下载文件,并安装gnutar,安装后转到C:\Program Files\GnuWin32\bin并复制bsdtar.exetar.exe.

确保tar命令在您的PATH变量中。

于 2014-05-19T20:58:07.183 回答