Play2:播放阶段命令失败并显示'not found:type SetupContext' [英] Play2: play stage command fails with 'not found: type SetupContext'

查看:183
本文介绍了Play2:播放阶段命令失败并显示'not found:type SetupContext'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm currently trying to deploy a Play 2.2.2 application to heroku and play stage command fails for me with the following output:

$ 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

I tried adding the jackson-databind depndency as well but it doesn't seem to help: "com.fasterxml.jackson.core" % "jackson-databind" % "2.2.2"

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

I've searched all over but can't seem to find the cause for this. There's a related discussion here:

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

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

It mentions disabling the scaladoc generation. Not sure whether this is the cause or how to do that with build.sbt instead of Build.scala as suggested by the discussion. Any insight appreciated.

推荐答案

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

So looks like all you need to do is add the following line to the end of your build.sbt:

sources in doc in Compile := List() 

希望这可以让别人头疼...

Hopes this saves someone else a headache..

这篇关于Play2:播放阶段命令失败并显示'not found:type SetupContext'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆