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

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

问题描述

我正在尝试使用stage"任务在 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上播放Framework 2 Stage Task,“输入行太长"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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