播放2.3.7 sbt multiproject编译器问题 [英] Play 2.3.7 sbt multiproject compiler issue

查看:85
本文介绍了播放2.3.7 sbt multiproject编译器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Play框架2.3.7,并使用sbt(sbt版本0.13.5)设置了一个多项目,该项目由四个模块组成. 在项目根目录的build.sbt文件中,我们定义了以下模块:

we're using Play framework 2.3.7 and have set up a multiproject with sbt (sbt version 0.13.5), which is consisting of four modules. In the build.sbt file of the project root we define the modules:

lazy val common = (project in file("modules/common")).enablePlugins(PlayJava, SbtWeb)

lazy val store = (project in file("modules/store")).enablePlugins(PlayJava, SbtWeb).dependsOn(common)

lazy val catalog = (project in file("modules/catalog")).enablePlugins(PlayJava, SbtWeb).dependsOn(common)

lazy val backend = (project in file("modules/backend")).enablePlugins(PlayJava, SbtWeb).dependsOn(common)

lazy val root = (project in file(".")).enablePlugins(PlayJava, SbtWeb).aggregate(common, store, catalog, backend).dependsOn(common, store, catalog, backend)

如果我们尝试使用来运行我们的应用程序

If we're trying to run our application with

activator run

它会编译应用程序而不会出现错误.在主页上发出第一个请求后,它将再次开始编译整个项目,最多四次. 这需要很长时间,但是之后一切正常.

it compiles the app without an error. After the first request on the mainpage, it starts compiling the whole project again... up to four times. This takes a long time, but after that everything works fine.

那是什么原因,该项目经常被编译?其他人偶然发现了这个问题吗?

So what's the reason, the project is compiled that often? Anyone else stumbled upon this problem?

谢谢.

推荐答案

在更新为使用ebean持久层播放2.3.7之后,我的项目中出现了相同的问题.

Had the same issue in my project after update to play 2.3.7 with ebean persistence-layer.

我注意到某些类总是会重新编译,尽管未对它们进行任何更改.这仅发生在使用注释@com.avaje.ebean.annotation.Transactional@Entity类中.

I noticed that some classes always get recompiled allthough no change was made to them. This only happened to @Entity-classes that used the annotation @com.avaje.ebean.annotation.Transactional.

不幸的是,使用注释@play.db.ebean.Transactional无效,它不会在单个事务中执行数据库命令.不确定,是否存在

Unfortunatly using the annotation @play.db.ebean.Transactional instead doesn't work, it won't execute the database commands within a single transaction. Not sure, wether there is either still a bug in it or this does only work for controller-classes but not for @Entity-classes.

但是,对我而言,解决此问题的方法是使用try/finally块来创建事务,如

However what fixed the issue for me, was using a try/finally block for creating a transaction as described in the ebean-documentation.

您碰巧使用ebean作为持久层吗?

Do you happen to use ebean as persistence layer?

删除@transactional注释是否可以解决您的问题?

Does removing the @transactional-annnotation fix your problem?

这篇关于播放2.3.7 sbt multiproject编译器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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