akka +使用sbt程序集播放依赖项问题

我正在使用sbt程序集尝试使用我们的应用程序并创建“一个大罐子”来部署它。akka +使用sbt程序集播放依赖项问题

我有一个问题,其中Play 2.1.2取决于scala-stm 0.6和akka-transactor 2.1.4取决于scala-stm 0.7。

我能够在SBT运行的应用程序没有问题(以及Eclipse的和IntelliJ)

我不清楚如何解决使用“SBT集”

下面这个问题是一些输出正好解释我所看到的(剪掉一些东西):

[NPL-play] $ assembly 

...

[info] Including from cache: akka-testkit_2.10-2.1.4.jar

[info] Including from cache: scala-stm_2.10.0-0.6.jar

...

[info] Including from cache: spray-httpx-1.1-M7.jar

[info] Including from cache: scala-stm_2.10-0.7.jar

...

[info] Including from cache: scala-library.jar

[info] Including from cache: voltdbclient-2.7.2.jar

[warn] Merging 'public/plugins/colreorder/docs/media/license' with strategy 'rename'

[warn] Merging 'public/plugins/colvis/docs/media/license' with strategy 'rename'

[warn] Merging 'public/images/icons/color/readme.txt' with strategy 'rename'

[warn] Merging 'public/plugins/flot/LICENSE.txt' with strategy 'rename'

[warn] Merging 'public/plugins/photoswipe/README.md' with strategy 'rename'

[error] (NPL-util/*:assembly) deduplicate: different file contents found in the following:

[error] /Users/worms/.ivy2/cache/org.scala-stm/scala-stm_2.10.0/jars/scala-stm_2.10.0-0.6.jar:scala/concurrent/stm/ccstm/CCSTMRefs.class

[error] /Users/worms/ivy2/cache/org.scala-stm/scala-stm_2.10/jars/scala-stm_2.10-0.7.jar:scala/concurrent/stm/ccstm/CCSTMRefs.class

[error] (NPL-admin/*:assembly) deduplicate: different file contents found in the following:

[error] /Users/worms/.ivy2/cache/org.scala-stm/scala-stm_2.10.0/jars/scala-stm_2.10.0-0.6.jar:scala/concurrent/stm/ccstm/CCSTMRefs.class

[error] /Users/worms/.ivy2/cache/org.scala-stm/scala-stm_2.10/jars/scala-stm_2.10-0.7.jar:scala/concurrent/stm/ccstm/CCSTMRefs.class

[error] Total time: 6 s, completed Aug 1, 2013 4:09:09 PM

[NPL-play] $

如果我看的依赖关系树我看到有依赖性冲突的两件事情(修剪了一堆东西了):

[NPL-play] $ dependency-tree 

[info] Updating {file:/Users/worms/dev/npl/}NPL-util...

[info] Updating {file:/Users/worms/dev/npl/}NPL-util...

[info] Done updating.

[info] Done updating.

[info] Updating {file:/Users/worms/dev/npl/}NPL-admin...

[info] Done updating.

[info] com.myorg:npl-admin_2.10:0.0.2 [S]

[info] +-com.myorg:networking_2.10:0.0.2 [S]

...

[info] | | |

[info] | | +-com.typesafe.akka:akka-transactor_2.10:2.1.4 [S]

[info] | | | +-com.typesafe.akka:akka-actor_2.10:2.1.4 [S]

[info] | | | | +-com.typesafe:config:1.0.0

[info] | | | |

[info] | | | +-org.scala-stm:scala-stm_2.10:0.7 [S]

...

[info] | +-play:play_2.10:2.1.3-RC1

...

[info] | +-play:play-iteratees_2.10:2.1.3-RC1

[info] | | +-com.github.scala-incubator.io:scala-io-file_2.10:0.4.2 [S]

[info] | | | +-com.github.scala-incubator.io:scala-io-core_2.10:0.4.2 [S]

[info] | | | +-com.jsuereth:scala-arm_2.10:1.3 [S]

[info] | | |

[info] | | +-com.typesafe:config:1.0.0

[info] | | +-org.scala-stm:scala-stm_2.10.0:0.6 [S]

...

有关如何解决此依赖性问题的任何建议?

=========================编辑:添加更简单的示例=============== ========

我决定尝试用Pla​​y和Akka创建一个非常简单的应用程序。然而,我试图“组装”一个简单的Play应用程序并遇到问题。

这里是我的项目/ plugins.sbt文件:

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" 

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.1")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

这里是我的项目/ Build.scala文件:

import sbt._ 

import Keys._

import play.Project._

import sbtassembly.Plugin._

import AssemblyKeys._

object ApplicationBuild extends Build {

val appName = "dependencyExample"

val appVersion = "1.0"

val appDependencies = Nil

val appSettings = Defaults.defaultSettings ++ assemblySettings ++ Seq(net.virtualvoid.sbt.graph.Plugin.graphSettings:_*)

val main = play.Project(appName, appVersion, appDependencies, settings = appSettings)

}

,这里是输出,我从 '装配'

得到

[dependencyExample] $ assembly 

[info] No tests to run for test:test

[info] Including from cache: jta-1.1.jar

[info] Including from cache: scala-arm_2.10-1.3.jar

[info] Including from cache: jcl-over-slf4j-1.6.6.jar

[info] Including from cache: jul-to-slf4j-1.6.6.jar

[info] Including from cache: commons-lang3-3.1.jar

[info] Including from cache: logback-classic-1.0.7.jar

[info] Including from cache: config-1.0.0.jar

[info] Including from cache: slf4j-api-1.6.6.jar

[info] Including from cache: commons-codec-1.3.jar

[info] Including from cache: async-http-client-1.7.6.jar

[info] Including from cache: joda-time-2.1.jar

[info] Including from cache: commons-logging-1.1.1.jar

[info] Including from cache: httpclient-4.0.1.jar

[info] Including from cache: jackson-mapper-asl-1.9.10.jar

[info] Including from cache: play-exceptions-2.1.0.jar

[info] Including from cache: scala-io-core_2.10-0.4.2.jar

[info] Including from cache: httpcore-4.0.1.jar

[info] Including from cache: logback-core-1.0.7.jar

[info] Including from cache: jackson-core-asl-1.9.10.jar

[info] Including from cache: scala-io-file_2.10-0.4.2.jar

[info] Including from cache: play-iteratees_2.10-2.1.0.jar

[info] Including from cache: joda-convert-1.2.jar

[info] Including from cache: javassist-3.16.1-GA.jar

[info] Including from cache: netty-3.5.9.Final.jar

[info] Including from cache: ehcache-core-2.6.0.jar

[info] Including from cache: akka-actor_2.10-2.1.0.jar

[info] Including from cache: signpost-commonshttp4-1.2.1.2.jar

[info] Including from cache: scala-stm_2.10.0-0.6.jar

[info] Including from cache: akka-slf4j_2.10-2.1.0.jar

[info] Including from cache: signpost-core-1.2.1.2.jar

[info] Including from cache: scala-reflect-2.10.0.jar

[info] Including from cache: play_2.10-2.1.0.jar

[info] Including from cache: sbt-link-2.1.0.jar

[info] Including from cache: templates_2.10-2.1.0.jar

[info] Including from cache: scala-library.jar

[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'

[error] (*:assembly) deduplicate: different file contents found in the following:

[error] /Users/worms/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar:org/apache/commons/logging/impl/SimpleLog.class

[error] /Users/worms/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.6.6.jar:org/apache/commons/logging/impl/SimpleLog.class

[error] Total time: 2 s, completed Aug 6, 2013 3:07:27 PM

[dependencyExample] $

目前还不清楚我该如何解决这个问题。我怀疑如果我能解决这个简单的测试问题,那么我可以解决Akka + Play问题。

===================编辑:完成相同的事情的不同方式=================

我发现了一个'神奇'sbt命令。 'DIST'。这将该应用程序打包到一个.zip文件中,然后可以解压缩并在任何安装了java的计算机上运行。

这里的博客文章在coursera我们找到的珍闻上:

http://betacs.pro/blog/2013/08/03/deploying-play-apps/

更多信息可以在这里找到:

http://www.playframework.com/documentation/2.1.x/ProductionDist

回答:

你可以exclude transitive dependencies。在这种情况下,我会删除0.6版本并留下0.7,因为它更新。

回答:

我发现了一个带有戏剧性的'神奇'sbt命令。 'DIST'。这将该应用程序打包到一个.zip文件中,然后可以解压缩并在任何安装了java的计算机上运行。

这里的博客文章在coursera我们找到的珍闻上:

http://betacs.pro/blog/2013/08/03/deploying-play-apps/

更多信息可以在这里找到:

http://www.playframework.com/documentation/2.1.x/ProductionDist

以上是 akka +使用sbt程序集播放依赖项问题 的全部内容, 来源链接: utcz.com/qa/259132.html

回到顶部