Play2:播放阶段命令失败,未找到:键入SetupContext'

时间:2014-04-09 21:58:06

标签: playframework jackson playframework-2.2

我正在尝试将一个Play 2.2.2应用程序部署到heroku,而play stage命令对我失败,输出如下:

$ play clean compile stage
[info] Loading project definition from /Users/apotapov/Dropbox/workspace/test/project
[info] Set current project to test (in build file:/Users/apotapov/Dropbox/workspace/test/)
[success] Total time: 0 s, completed Apr 9, 2014 4:45:28 PM
[info] Updating {file:/Users/apotapov/Dropbox/workspace/test/}test...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 3 Scala sources and 70 Java sources to /Users/apotapov/Dropbox/workspace/test/target/scala-2.10/classes...
[success] Total time: 28 s, completed Apr 9, 2014 4:45:56 PM
[info] Packaging /Users/apotapov/Dropbox/workspace/test/target/scala-2.10/test_2.10-1.0-SNAPSHOT-sources.jar ...
[info] Wrote /Users/apotapov/Dropbox/workspace/test/target/scala-2.10/test_2.10-1.0-SNAPSHOT.pom
[info] Done packaging.
[info] Main Scala API documentation to /Users/apotapov/Dropbox/workspace/test/target/scala-2.10/api...
[info] Packaging /Users/apotapov/Dropbox/workspace/test/target/scala-2.10/test_2.10-1.0-SNAPSHOT.jar ...
[info] Done packaging.
[error] /Users/apotapov/Dropbox/workspace/test/app/com/bvg/controllers/json/serializers/TestJacksonModule.java:17: not found: type SetupContext
[error]     public void setupModule(SetupContext context) {
[error]                             ^
model contains 120 documentable templates
[error] one error found
[error] (compile:doc) Scaladoc generation failed
[error] Total time: 10 s, completed Apr 9, 2014 4:46:07 PM

这是我的 build.sbt

name := "test"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
    javaJdbc,
    cache,
    "be.objectify" %%                       "deadbolt-java" %               "2.2.1-RC2",
    "com.google.guava" %                    "guava" %                       "r09",
    "com.codahale.metrics" %                "metrics-core" %                "3.0.1",
    "org.springframework" %                 "spring-context" %              "4.0.2.RELEASE",
    "org.springframework.data" %            "spring-data-jpa" %             "1.5.1.RELEASE",
    "postgresql" %                          "postgresql" %                  "9.1-901.jdbc4",
    "org.hibernate" %                       "hibernate-entitymanager" %     "4.3.4.Final",
    "com.typesafe" %%                       "play-plugins-redis" %          "2.2.0",
    "com.typesafe.play" %%                  "play-cache" %                  "2.2.0",
    "com.restfb" %                          "restfb" %                      "1.6.11"
)

resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns)

resolvers += Resolver.url("Objectify Play Snapshot Repository", url("http://schaloner.github.com/snapshots/"))(Resolver.ivyStylePatterns)

resolvers += "Sedis Repo" at "http://pk11-scratch.googlecode.com/svn/trunk"

play.Project.playJavaSettings

以下是有问题的文件:

package com.bvg.controllers.json.serializers;

import java.util.Map;

import com.fasterxml.jackson.databind.module.SimpleModule;

public class TestJacksonModule extends SimpleModule {
    private static final long serialVersionUID = 1L;

    protected Map<Class<?>, Class<?>> mixIns;

    public FeudJacksonModule() {
        super("FeudJacksonModule");
    }

    @Override
    public void setupModule(SetupContext context) {
        super.setupModule(context);

        for (Map.Entry<Class<?>, Class<?>> mixIn : mixIns.entrySet()) {
            context.setMixInAnnotations(mixIn.getKey(), mixIn.getValue());
        }
    }

    public void setMixIns(Map<Class<?>, Class<?>> mixIns) {
        this.mixIns = mixIns;
    }
}

我尝试添加jackson-databind depndency但它似乎没有帮助:"com.fasterxml.jackson.core" % "jackson-databind" % "2.2.2"

我已经搜遍过,但似乎无法找到原因。这里有一个相关的讨论:

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

它提到禁用scaladoc一代。根据讨论的建议,不确定这是使用build.sbt而不是Build.scala的原因或方法。任何洞察力都赞赏。

1 个答案:

答案 0 :(得分:11)

所以你需要做的就是在build.sbt的末尾添加以下行:

sources in doc in Compile := List() 

希望这能让别人头疼......