如何将 sbt 与 Google App Engine 结合使用?
有人尝试过设置 sbt 来与 Google App Engine 一起使用吗?我梦想在源代码更改后使用开发服务器自动重新加载。
Has anybody tried to setup sbt to work with Google App Engine? I dream about using development server auto-reloading after source changes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如需快速演示,您可以在此处克隆或下载我所做的工作。
从头开始的简约sbt-appengine-plugin示例
克隆 sbt-appengine-来自 GitHub 的插件
在本地发布插件,以便您可以在自己的项目中使用它
为新项目创建目录
配置新项目< /strong>
告诉 sbt 你想要使用的插件
project.scala
plugins.scala
添加一个非常简单的 servlet >
HelloWorld.scala
添加更多配置文件
web.xml
appengine-web.xml
最后运行 sbt 并启动项目
将浏览器指向 http://localhost:8080/ 并你应该看到 Hello, world
为了观察源文件的变化,我在启动服务器后用 ~prepare-webapp 做了一些实验,但我还没有让它正常工作。
For a quick demo you can clone or download what I have done here.
A minimalistic sbt-appengine-plugin example from scratch
Clone the sbt-appengine-plugin from GitHub
Publish the plugin locally so that you can use it in your own projects
Create a directory for a new project
Configure the new project
Tell sbt about the plugin you want to use
project.scala
plugins.scala
Add a very simple servlet
HelloWorld.scala
Add some more configuration files
web.xml
appengine-web.xml
And finally run sbt and start the project
Point your browser to http://localhost:8080/ and you should see Hello, world
To watch for changes in source files I have experimented a little with ~prepare-webapp after starting the server, but I haven't gotten it working properly.
这是我在 Github 上的 sbt-appengine-plugin试图立即开始工作。我会发布任何进展。
Here is an sbt-appengine-plugin on Github that I'm trying to get to work right now. I will post any progress.
您可以在这里找到该插件作者的示例:
http://gist.github.com/377611
特别是在插件配置中,1.1-的设置SNAPSHOT(上面提到的)或 2.1-SNAPSHOT(在 sbt-apppengine-plugin README 中提到的)不起作用。
这个例子表明:
这对我有用。
You will find an example by the author of the plugin here:
http://gist.github.com/377611
Especially in the plugins configuration, the setting of 1.1-SNAPSHOT (mentioned above) or 2.1-SNAPSHOT (mentioned in the sbt-apppengine-plugin README) did not work.
The example shows:
And this worked for me.
这是一个使用 sbt + appengine 的模板项目,可用于入门:
https://github .com/mtkopone/sbt-scalatra-appengine-template
此外,您可以在 Plugins.scala 中使用以下内容,而不必在本地发布 sbt-appengine-plugin:
Here's a template project using sbt + appengine which can be used to get started:
https://github.com/mtkopone/sbt-scalatra-appengine-template
Also, instead of having to publish the sbt-appengine-plugin locally, you can use the following in Plugins.scala:
我编写了一个示例应用程序,描述如何设置开发环境并使用 SBT 和应用程序引擎创建应用程序。它还包括有关设置 JRebel 以获得您梦想的自动重新加载的说明。
请参阅 http://jeremys-scala-example.appspot.com/
它适用于 SBT 0.7所以它有点过时了。
I wrote an example application describing how to set up a development environment and create an application using SBT and app engine. It also includes instructions on setting up JRebel to get the auto reloading you dream of.
See http://jeremys-scala-example.appspot.com/
It is for SBT 0.7 so its a little out of date.
现在有一个新版本的 sbt-appengine 插件,可与较新版本的 SBT (0.10+) 配合使用,网址为 https ://github.com/sbt/sbt-appengine。 https://github.com/sbt/sbt-appengine。
我刚刚转换了一个使用 Eclipse 创建的项目:
There is now a new version of the sbt-appengine plugin which works with newer versions of SBT (0.10+) at https://github.com/sbt/sbt-appengine. There's also a trivial sample app using it at https://github.com/sbt/sbt-appengine.
I just converted a project that was created with Eclipse:
在谷歌搜索中找到了这篇文章。由于所有提供的示例都很旧,我根据我在网上找到的内容创建了两个示例项目
使用 Scala 编写的示例 GAE 应用程序 Scalatra 2.0.5、Scala 2.10.3 和 SBT 0.13
https://github.com/cppexpert/scalatra-google-app-engine-app
使用 Unfiltered 0.7、Scala 2.10.3 在 Scala 中编写的示例 GAE 应用程序和SBT 0.13
https://github.com/cppexpert/sample-scala-google-app -engine-app
Found this post in Google search. Since all provided examples are quite old I created two sample projects based on what I found online
Sample GAE app written in Scala using Scalatra 2.0.5, Scala 2.10.3 and SBT 0.13
https://github.com/cppexpert/scalatra-google-app-engine-app
Sample GAE app written in Scala using Unfiltered 0.7, Scala 2.10.3 and SBT 0.13
https://github.com/cppexpert/sample-scala-google-app-engine-app