播放框架。无需编译 [英] Play framework. no need to compile

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

问题描述

我被介绍到Play框架,我发现的一个惊人的事情是,没有必要编译项目。您只需要保存编辑的文件并重新加载网页。

I was introduced to the Play framework, and one of the amazing things I found about it is that there is no need to compile the project. You only need to save the edited files and reload the webpage.

我已经知道Java源代码被编译为字节码,然后使用JIT编译器编译,那么Play框架中的神奇之处是什么?

I've been taught that Java source code is compiled to bytecode and then compiled with the JIT compiler, so what is the magic inside of the Play framework?

推荐答案

当在DEV模式下运行时,Play通过检查java文件的最后修改日期,并交叉引用它们与.class文件它们在运行时生成。

When running in DEV mode, Play works by checking the last modified date of the java files, and cross referencing them with the .class files that are generated at run time. If it recognises something has changed, then it recompiles them, at runtime.

在Play 1.x中 - 重新编译是使用eclipse jdt编译器(org.eclipse)完成的。 jdt.internal.compiler.Compiler)。如果您想查看Play 1.x中的代码,只需查看以下类 - https://github.com/playframework/play/blob/master/framework/src/play/classloading/ApplicationCompiler.java

In Play 1.x - the recompilation is done using the eclipse jdt compiler (org.eclipse.jdt.internal.compiler.Compiler). If you want to see the code from Play 1.x, just look at the following class - https://github.com/playframework/play/blob/master/framework/src/play/classloading/ApplicationCompiler.java

在Play 2.x中,它看起来好像Play通过与SBT工具交互链接。查看此选项 - https: //github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/core/system/ApplicationProvider.scala

In Play 2.x, it looks as though Play does it by interlinking with the SBT tool. Check this out - https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/core/system/ApplicationProvider.scala

这篇关于播放框架。无需编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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