为什么Play端口没有开始使用库子项目?

时间:2014-10-09 14:40:14

标签: scala playframework sbt

build.sbt我有以下几行:

lazy val sparkCommon = (project in file("spark-common"))//.enablePlugins(PlayScala)

lazy val root = (project in file(".")).enablePlugins(PlayScala)
                  .dependsOn(sparkCommon).aggregate(sparkCommon)

spark-common项目中,我的代码位于src/main/scala/SimpleApp.scala

 object SimpleApp {
    def getStr = "{ name = 'adf'}"
 }

在我的Spark项目中root我正在尝试使用该代码。

上面的build.sbt文件端口监听没有启动,我无法访问我的服务(但它成功编译项目,可以生成两个包并将它们发布到repo)。

如果我在enablePlugins(PlayScala)文件中为我的库spark-common项目取消注释行build.sbt,则它看不到SimpleApp(据我所知,Play项目的结构有点不同因此编译错误是合理的,因为代码位于/spark-common/src/main/scala/SimleApp.scala)下。

我似乎遵循guideline (我使用Play 2.3.4),但它不起作用。可能是什么问题?

激活器运行/ sbt运行命令结果:

[info] Done updating.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/tkacheni/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.5.jar!/o
rg/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/tkacheni/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1
.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
--- (Running the application from SBT, auto-reloading is enabled) ---

log4j:WARN No appenders could be found for logger (org.jboss.netty.channel.socket.nio.SelectorUtil).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

(Server started, use Ctrl+D to stop and go back to the console...)

项目命令结果:

[rest-service] $ projects
[info] In file:/C:/Git/rest-service/
[info]   * root
[info]     sparkCommon
[rest-service] $

如果我上次运行,我可以看到这样的错误:

java.lang.RuntimeException: No main class detected.
        at scala.sys.package$.error(package.scala:27)
        ...

我在Google groups找到了类似的问题,但它并没有帮助我

0 个答案:

没有答案