且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Grails创建独立的应用程序

更新时间:2022-05-24 18:24:46

查看 独立插件 它使分发Grails应用的演示版变得更加容易.

Check out the standalone plugin it makes it a lot easier to distribute a demo version of your Grails app.

"独立插件构建了带有嵌入式war的可运行JAR文件 由您的应用程序和嵌入式Tomcat 7实例构建.这 允许您构建一个可以在任何计算机上运行的存档 Java 5或更高版本,只需运行java -jar standalone.jar.这可以是 方便演示,甚至轻量级的低流量安装 Grails应用程序."

"The Standalone plugin builds a runnable JAR file with an embedded war built from your application and an embedded Tomcat 7 instance. This allows you to build a single archive that can be run on any computer with Java 5 or higher by running java -jar standalone.jar. This can be convenient for demos or even very lightweight installs of low-traffic Grails applications."

独立插件的完整文档位于此处

Full docs for the standalone plugin are here

要准备jar文件...

To prepare the jar file...

grails -Dgrails.env=demo build-standalone our_cool_demo.jar

要运行Grails应用程序(将端口指定为参数)...

To run the Grails app (the port is specified as a parameter)...

java -jar /path/to/jar_name.jar cool_demo localhost 9000

更新:

实际上有2个Grails独立插件:

There are actually 2 Grails standalone plugins:

  1. 上述基于 Tomcat7 '独立'插件>
  2. ' jetty-standalone '插件,该插件基于 Jetty ,并且以类似的方式工作
  1. The 'standalone' plugin described above which is based on Tomcat7
  2. The 'jetty-standalone' plugin which is based on Jetty and works in a similar way

还有一些基于Hudson和Winstone项目的选项,但是没有Grails插件.以下是一些包含更多信息的链接: 建立可执行文件之战使用grails,maven和jetty 带有Jetty的可执行WAR Winstone

There are also some options based on Hudson and the Winstone project but there isn't a Grails plugin. Here are some links with further information: Build executable war using grails, maven and jetty, Executable WARs with Jetty and Winstone