为什么 Play Framework 在新项目模板中使用旧版本的 Ebean?

Why Play Framework uses old Ebean version in the new project templates?

我一直在用头撞墙(几乎是字面上的意思)试图弄清楚为什么我在过去 17 天 遇到这个 问题(现在你相信,不是吗?)。

所以,通过阅读和阅读 Play 的文档,我注意到了一些东西(我不知道我以前怎么没注意到!)。

配置 Ebean Play 与 Ebean ORM 一起提供。要启用它,请将 Play Ebean 插件添加到 project/plugins.sbt:

中的 SBT 插件
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.0")

此外,阅读 Play's forum 上的一些帖子,我注意到版本 2.5.6 已发布,我使用的是版本 2.5.4,无论如何我都升级了它成功了,它解决了我的 NullPointerException 问题。

但是,我已经通过 Play 的模板创建了一个新项目:

activator new

Fetching the latest list of templates...

Browse the list of templates: http://lightbend.com/activator/templates
Choose from these featured templates or enter a template name:
  1) minimal-akka-java-seed
  2) minimal-akka-scala-seed
  3) minimal-java
  4) minimal-scala
  5) play-java
  6) play-scala
(hit tab to see a list of all templates)
> 5
Enter a name for your application (just press enter for 'play-java')
> a-new-project
OK, application "a-new-project" is being created using the "play-java" template.

To run "a-new-project" from the command line, "cd a-new-project" then:
/tmp/000/a-new-project/activator run

To run the test for "a-new-project" from the command line, "cd a-new-project" then:
/tmp/000/a-new-project/activator test

To run the Activator UI for "a-new-project" from the command line, "cd a-new-project" then:
/tmp/000/a-new-project/activator ui

然后检查 project/plugins.sbt 文件:

// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(PlayEbean).
// addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")

这引出了我的问题:如果您要通过 play 的项目模板开始一个新项目,为什么要从最旧版本的插件开始?最好从这些插件的最新版本入手?

您可以在我的存储库中看到我的更改 here

没什么大不了的。只是模板过时了。 play-java 模板在此处定义:

https://github.com/playframework/playframework/tree/master/templates/play-java

而且,您可以看到模板在这里添加了 play-ebean 插件:

https://github.com/playframework/playframework/blob/master/templates/play-java/project/plugins.sbt#L21

很遗憾,EBEAN_VERSION 变量没有更新,正如您在此处看到的:

https://github.com/playframework/playframework/blob/master/templates/build.sbt#L62

如果需要,您可以提交一个(非常小且具体的)拉取请求来解决这个问题。

编辑:

此拉取请求更新模板插件:https://github.com/playframework/playframework/pull/6515