Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For a quick demo you can clone or download what I have done <a href="http://github.com/leolannenmaki/sbt-appengine-plugin-skeleton" rel="noreferrer">here</a>.</p> <h1>A minimalistic <a href="http://github.com/Yasushi/sbt-appengine-plugin" rel="noreferrer">sbt-appengine-plugin</a> example from scratch</h1> <p><strong>Clone the sbt-appengine-plugin from GitHub</strong></p> <pre><code> cd mystuff git clone git://github.com/Yasushi/sbt-appengine-plugin.git cd sbt-appengine-plugin sbt </code></pre> <p><strong>Publish the plugin locally so that you can use it in your own projects</strong></p> <pre><code>publish-local exit </code></pre> <p><strong>Create a directory for a new project</strong></p> <pre><code>cd .. mkdir sbt-appengine-plugin-test cd sbt-appengine-plugin-test sbt </code></pre> <p><strong>Configure the new project</strong></p> <pre><code>Project does not exist, create new project? (y/N/s) y Name: sbt-appengine-plugin-test Organization: com.example Version [1.0]: Scala version [2.7.7]: 2.8.0.Beta1 sbt version [0.7.3]: exit </code></pre> <p><strong>Tell sbt about the plugin you want to use</strong></p> <pre><code>mkdir project/build mkdir project/plugins nano project/build/project.scala </code></pre> <p><strong>project.scala</strong></p> <pre><code>import sbt._ class AppengineTestProject(info: ProjectInfo) extends AppengineProject(info) nano project/plugins/plugins.scala </code></pre> <p><strong>plugins.scala</strong></p> <pre><code>import sbt._ class Plugins(info: ProjectInfo) extends PluginDefinition(info) { val a = "net.stbbs.yasushi" % "sbt-appengine-plugin" % "1.1-SNAPSHOT" } </code></pre> <p><strong>Add a very simple servlet</strong></p> <pre><code>mkdir -p src/main/scala/com/example nano -w src/main/scala/com/example/HelloWorld.scala </code></pre> <p><strong>HelloWorld.scala</strong> </p> <pre><code>package com.example; import javax.servlet.http.{HttpServlet, HttpServletRequest, HttpServletResponse} class HelloWorld extends HttpServlet { override def doGet(request: HttpServletRequest, response: HttpServletResponse$ response.setContentType("text/plain") response.getWriter.println("Hello, world") } } </code></pre> <p><strong>Add some more configuration files</strong></p> <pre><code>mkdir -p src/main/webapp/WEB-INF nano -w src/main/WEB-INF/web.xml </code></pre> <p><strong>web.xml</strong> </p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xm$ version="2.5"&gt; &lt;display-name&gt;sbt-appengine-plugin usage example&lt;/display-name&gt; &lt;servlet&gt; &lt;servlet-name&gt;helloworld&lt;/servlet-name&gt; &lt;servlet-class&gt;com.example.HelloWorld&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;helloworld&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; nano -w src/main/WEB-INF/appengine-web.xml </code></pre> <p><strong>appengine-web.xml</strong> </p> <pre><code>&lt;appengine-web-app xmlns="http://appengine.google.com/ns/1.0"&gt; &lt;!-- Replace this with your application id from http://appengine.google.com -$ &lt;application&gt;hello-world&lt;/application&gt; &lt;version&gt;1&lt;/version&gt; &lt;/appengine-web-app&gt; </code></pre> <p><strong>And finally run sbt and start the project</strong></p> <pre><code>sbt update dev-appserver-start </code></pre> <p><strong>Point your browser to <a href="http://localhost:8080/" rel="noreferrer">http://localhost:8080/</a> and you should see Hello, world</strong></p> <pre><code>dev-appserver-stop </code></pre> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload