今日提供的更轻松迁移至 Play 2 的选项

发布于 2024-12-17 16:47:43 字数 473 浏览 4 评论 0原文

我是 Scala 和 Play 的新手,我正在考虑将它们用于新项目。 我看到 Play 2 的开发进展顺利,尽管稳定版本仍然是 1.x。并且存在实质性差异< /a> 介于两者之间。

我想知道的是,如果我现在开始一个 Play 1.x 项目,我可以采取哪些选项来方便将来迁移到 Play 2?

即:

  • Play 2 使用 Ebean 作为默认 ORM,您建议我使用它来代替 Play 1.x 的 ORM (Hibernate) 吗?
  • 模板系统怎么样?我现在可以做些什么来让以后更容易迁移?
  • 当我决定将来将我的应用程序移植到 Play 2 时,我还需要担心什么?

I'm new to Scala and to Play, and I'm considering using them for a new project.
I see the development on Play 2 is coming along nicely, although the stable version is still 1.x. And there are substantial differences between the two.

What I'm wondering is, if I start a Play 1.x project now, what options can I take that will ease migration to Play 2 in the future?

Namely:

  • Play 2 uses Ebean as the default ORM, would you advise me to use it instead of Play 1.x's ORM (Hibernate)?
  • What about the template system; anything I can do now to make it easier to migrate later on?
  • What else will I have to worry about when I decide to port my app to Play 2 in the future?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如何视而不见 2024-12-24 16:47:43

关于迁移本身:

  • 计划将 Groovy 模板迁移到 Play 2(我相信这项工作正在进行中)。如果您开始将 Play 1.x 与 Scala 一起使用,则可以缓解这一问题,因为模板系统将是 Scala 系统。
  • 从 Hibernate 更改为 Ebean 应该很容易,除非您使用 Hibernate 特定的扩展。
  • 配置和一些作业(如@OnApplicationStart)可能会改变,但这应该很容易移植(只需移动它们)。
  • 您访问路线和资产的方式将会发生变化,这可能会给您带来一些额外的工作来适应代码/模板。

一般来说,它不应该太复杂,但正如@lacy所说,这取决于你的截止日期和项目本身。如果这是一个关键项目,要在 2012 年 3 月之前完成,我会选择 Play 1.x。如果它是一个不太重要的项目,可能会被推迟,并且无论如何都不会在 2012 年 3 月之前发布,请尝试 Play 2.0。

On the migration itself:

  • There're plans to migrate the Groovy templates to Play 2 (I believe is work in progress). You can mitigate this is you start using Play 1.x with Scala, as the template system will be the Scala one.
  • Changing from Hibernate to Ebean should be easy unless you use Hibernate-specific extensions.
  • Configuration and some jobs (like @OnApplicationStart) may change, but this should be quite easy to port (just move them around).
  • There will be changes to the way you access routes and assets, which may give you some extra work adapting code/templates.

In general it shouldn't be too complex, but as @lacy said, it depends on your deadlines and the project itself. If it's a critical project, to be finished before next March 2012, I would go with Play 1.x. If it's a less important project, which could be delayed, and that in any case won't be released before March 2012, try Play 2.0.

南城追梦 2024-12-24 16:47:43

目前我什至都懒得在项目中使用 Play2。它仍然缺乏一些功能,即使开发继续进行,我也会坚持使用 Play 1.2.x。即使我不得不承认尝试 2.0 很诱人。

但我永远不会选择中间的解决方案。从 Play 1.2.x 开始并尝试迁移到 2.0.0。它称为语义版本控制。当主数增加时,没有向后兼容性。这意味着,您可以使用 play 1.2.x 或 Play 2.0。尝试迁移会给你带来比你想要的更多的压力和问题。

I wouldn't even bother using Play2 on project for the moment. It still lacks some features and even if the development is going forward, I would stick with Play 1.2.x. Even if I have to admit it is tempting to try 2.0.

But I would never chose the in between solution, though. Starting in Play 1.2.x and trying to migrate toward 2.0.0. It is called Semantic Versionning. When the major number increases, there is no backward-compatibility. Meaning, you either use play 1.2.x or Play 2.0. Trying to migrate is going to cause you more stress, problems then you want to.

未央 2024-12-24 16:47:43

这一切都与您的项目截止日期有关。 Play2 即将推出,一些组件看起来已经相当稳定。所以,如果时间允许,我推荐你使用Play2。它最近已将状态更改为 Beta。几天前,Guillaume 在 Github 上创建了一个有用的 wiki。您还可以关注 Play2 源码中的示例。而且,据我了解,从 Play1X 到 Play2 不会有任何迁移指南。

This' all about your project's deadlines. Play2 is coming soon and some components already seem quite stable. So, if time allows, I would recommend you to use Play2. It recently has changed status to Beta. Several days ago Guillaume created a useful wiki on Github. You can also pay attention to the examples in the Play2 sources. And, as I understand, there will be no migration guidelines from Play1X to Play2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文