Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
552 views
in Technique[技术] by (71.8m points)

playframework 2.0 - Play Framework 2 Stage Task on Windows, "The input line is too long"

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.

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.

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.

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.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I also had the same issue and I wasn't satisfied with the solutions that you provided.

I have found a simpler solution.

Add the following line to the build.sbt file

lazy val root = (project in file(".")).enablePlugins(PlayScala, LauncherJarPlugin)

Now if you generate your production application with:

sbt dist

or run a production mode with

sbt start

The LauncherJarPlugin plugin will take care for generating proper bash/batch run scrips.

To get to know more about LauncherJarPlugin please read the documentation:

Sbt documentation about long classpath

How to enable plugin in build sbt


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...