在Windows上执行Play Framework 2 Stage Task,“输入行太长"; [英] Play Framework 2 Stage Task on Windows, "The input line is too long"

查看:112
本文介绍了在Windows上执行Play Framework 2 Stage Task,“输入行太长";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用"阶段"任务在Windows Server Server 2012上播放2应用程序,目的是将其包装在服务中,以便在服务器重新启动时应用程序将自动运行.但是,在运行该应用程序时,我收到以下消息:

I'm trying to Play 2 application on Windows Server Server 2012 using the "stage" task, with the goal of wrapping this up in a service so the application will automatically run when the server gets restarted. However, when running the app I get the following message:

The input line is too long.
The syntax of the command is incorrect.

这是因为Windows的命令行说明具有限制为8000个左右个字符,但似乎是Play stage命令通过传递类路径作为参数来超出此范围.

This is because Windows has a limit of around 8000 characters for command line instructions but it seems like the Play stage command is exceeding this by passing the classpath as an argument.

将"stage"文件夹复制到c:\ 可能可以解决此问题(因为这会减小类路径的大小),但是我希望有一个更优雅的解决方案.

Copying the "stage" folder to c:\ might fix the issue (as it'll reduce the size of the classpath) but I was hoping there would be a more elegant solution.

有人找到解决这个问题的方法吗?或者,人们对在Windows上运行Play应用程序有何建议,以便在服务器重新启动时自动运行.

Has anyone found a way around this? Alternatively, do people have any suggestions for running a Play application on Windows so that it will automatically run when the server is restarted.

谢谢.

推荐答案

更新:sbt本机打包程序现在提供了许多内置解决方案,请参见下面的NieMaszNic答案.

UPDATE: sbt native packager now comes with a number of built in solutions to this, see NieMaszNic's answer below.

这是一个已知问题,可以在此处的SBT本机打包程序(生成启动脚本)中进行跟踪:

This is a known issue, being tracked in the SBT native packager (which generates the start script) here:

https://github.com/sbt/sbt-native-packager /issues/72

我建议解决此问题的方法是编写您自己的使用通配符类路径匹配器的启动批处理脚本.您可以将该脚本放在Play项目的dist目录中,最终将与您的应用程序打包在一起.该脚本可能如下所示:

My recommendation to work around this issue would be to write your own start batch script that uses a wildcard classpath matcher. You can put this script in the dist directory in your Play project, and it will end up being packaged up with your application. That script might look like this:

java %1 -cp "./lib/*;" play.core.server.NettyServer .

请注意,如果使用通配符类路径匹配器,则不能再依赖类路径顺序来与开发模式下的顺序相同.无论如何,您都不应该依赖于类路径的排序,但是人们不可避免地要这样做.

Note that if you use a wildcard classpath matcher, you can no longer rely on classpath ordering to be the same as in dev mode. You shouldn't rely on classpath ordering anyway, but people inevitably do.

这篇关于在Windows上执行Play Framework 2 Stage Task,“输入行太长";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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