私はGitHubのから次のコードを取った:私はこのプログラムを実行したいが、私は、正しいbuild.sbtファイルが必要Scalaプロジェクトのbuild.sbtファイルを作成する方法は?
object GraphExample {
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl._
import FlowGraph.Implicits._
import scala.util.{ Failure, Success }
import scala.concurrent.ExecutionContext.Implicits._
implicit val system = ActorSystem("Sys")
implicit val materializer = ActorMaterializer()
def main(args: Array[String]): Unit = {
val out = Sink.foreach(println)
val g = FlowGraph.closed(out) { implicit builder =>
sink =>
val in = Source(1 to 10)
val bcast = builder.add(Broadcast[Int](2))
val merge = builder.add(Merge[Int](2))
val f1, f2, f3, f4 = Flow[Int].map(_ + 10)
in ~> f1 ~> bcast ~> f2 ~> merge ~> f3 ~> sink.inlet
bcast ~> f4 ~> merge
}.run()
// ensure the output file is closed and the system shutdown upon completion
g.onComplete {
case Success(_) =>
system.shutdown()
case Failure(e) =>
println(s"Failure: ${e.getMessage}")
system.shutdown()
}
}
}
を。私はそれを書き始め、そして私が持っている:
name := "Hello Test #1"
version := "1.0"
scalaVersion := "2.11.8"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
// to be completed
)
私の質問は以下のとおりです。私はlibraryDependencyの内側に記述する必要がありますどのようなライン 1.?各依存関係の形式は、groupID%artifactID%リビジョンである必要があります。インポートごとにこれらのパラメータを見つけるにはどうすればよいですか? 2.プロジェクトを実行するには、build.sbtファイル内に他の変数が必要ですか?
これはGitHubへのリンクです:https://gist.github.com/rocketpages/ed514d309da87711c821#file-streamexample-scala。 build.sbtファイルが見つかりませんでした。 – CrazySynthax
@CrazySynthax - GitHubリポジトリではありません。その場合はもちろん、ライブラリを推測する必要があります。これはAkkaの公式ドキュメント(http://doc.akka.io/docs/akka/2.4.9/scala/stream/stream-graphs.html –
)の例に基づいているようです。ライブラリを推測する "スマートな"方法がありますか?私の問題はライブラリを推測するだけでなく、artifactIDとリビジョンを推測することです。 – CrazySynthax