Play2: play stage command fails with 'not found: type SetupContext'

让人想犯罪 __ 提交于 2019-12-11 07:14:07

问题


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

Here's my 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

Here's the offending file:

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;
    }
}

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

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.


回答1:


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..



来源:https://stackoverflow.com/questions/22974766/play2-play-stage-command-fails-with-not-found-type-setupcontext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!