1

Upon migrating from 2.04 to 2.1, we encountered a problem with our publish task that sends the zip file from the dist task to Artifactory.

Now what we are getting is the folowing error:

Internal task engine error: nothing running.  This usually indicates a cycle in tasks.

There is discussion about this in the play framework user groups:

https://github.com/playframework/Play20/pull/535

and

https://groups.google.com/forum/#!topic/play-framework/BoWw65F6vg8

We basically tried to do what they recommend but we are getting nowhere. Could someone please give us an example of what the Build.scala should look like?

What we have is the following:

  /*
    In order to solve the cycle generated during the dist task in play 2.1
  */
  val distHack = TaskKey[File]("dist-hack", "Hack to publish dist")

  val myDistSettings = Seq[Setting[_]] (
      publish <<= (publish) dependsOn play.Project.dist,
      publishLocal <<= (publishLocal) dependsOn play.Project.dist,
      artifact in distHack ~= { (art: Artifact) =>
        art.copy(`type` = "zip", extension = "zip")
      },
      distHack <<= (distDirectory, version) map { (d, v) =>
        val packageName = "%s-%s" format(appName, v)
        println(packageName)
        val zip = d / (packageName + ".zip")
        zip
      }
    ) ++ Seq(addArtifact(artifact in distHack, distHack).settings: _*)

    lazy val main = play.Project(appName, appVersion, appDependencies)
        ...
    .settings(addArtifact(Artifact(appName, "zip","zip"), dist).settings : _*)
            ...
    .settings(
        // disable publishing the main jar produced by `package`
        publishArtifact in (Compile, packageBin) := false,

        // disable publishing the main API jar
        publishArtifact in (Compile, packageDoc) := true,

        // disable publishing the main sources jar
        publishArtifact in (Compile, packageSrc) := false,
        publishArtifact in Test := false,
        crossPaths := false, 
        publishTo := Some("Artifactory Realm" at "somewhere"),
        credentials += Credentials(".credentials"),
        scalacOptions ++= Seq("-feature")
    )
    .settings(myDistSettings: _*)
4

1 回答 1

2

问题是 dist 任务和发布任务在一个循环中。所以我们所要做的就是让发布任务依赖于distHack。换句话说,我们替换了这个:

.settings(addArtifact(Artifact(appName, "zip","zip"), dist).settings : _*)

.settings(addArtifact(Artifact(appName, "zip","zip"), distHack).settings : _*)

还有另一个问题。主 app.jar 未包含在 dist 中。所以我们不得不注释在 2.0.4 中阻止发布打包二进制文件的行:

//publishArtifact in (Compile, packageBin) := false,
于 2013-07-04T21:24:32.760 回答