2015-11-10 5 views
0

Мой simple Play 2.4 project не компилируется, когда я переименовываю файл conf/routes на что-то еще, например. conf/hello.routes. Причина, по которой я делаю это, - включить состав API, позволяя им разрабатываться в отдельных репозиториях git и проектах sbt.Использование Play 2.4 с переименованным файлом `conf/routes`

Идея поддержки мультипроекта основана на this project и blog post - но это использование Play 2.3.

Ошибки я получаю:

$ sbt test 
... 
[info] Hello should 
[error] ! give {hello: true} 
[error] Unable to provision, see the following errors: 
[error]  
[error] 1) Error in custom provider, java.lang.ClassCastException: interface play.api.routing.Router is not assignable from class hello.routes 
[error]  while locating play.api.test.FakeRouterProvider 
[error]  while locating play.api.routing.Router 
[error]  
[error] 1 error (InjectorImpl.java:1025) 
[error] com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025) 
[error] com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051) 
[error] play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:321) 
[error] play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:316) 
... 

ответ

1

Получил этот решен (код в мерзавца репо теперь работает).

Проблемы были, вероятно, связано с обоих из них:

  • Controller реализация хочет быть в пакете controllers.hello вместо просто hello
  • в файле application.conf следует опустить controllers пространство имен, т.е. play.http.router = app.Routes

Я узнал об этом просто, сравнив этот код с образцом которые работают.

Смежные вопросы