更新时间:2023-01-06 22:38:36
WAR文件旨在部署到诸如Tomcat或Jetty之类的独立应用程序服务器中.嵌入式码头反之亦然.您有一个独立的Java应用程序,并且在您的应用程序内部,启动了以相同进程运行的Jetty服务器.通过该配置,您可以通过Web界面增强应用程序,甚至可以将其他Web应用程序(WAR)部署到嵌入式Jetty中.
A WAR file is meant to be deployed into a stand alone application server like Tomcat or Jetty. The embedded Jetty is vice versa. You have a standalone Java application and inside your application you start a Jetty server running in the same process. With that configuration you can enhance your application with a web interface or you can even deploy other web applications (WARs) into your embedded Jetty.
因此,使用包含嵌入式Jetty的WAR毫无意义.如果您嵌入Jetty,则您的应用程序应该是具有主类的普通JAR.如果您能够通过IDE启动应用程序,那么下一步将是构建JAR并尝试通过命令行启动它.为此,创建一个批处理文件或Shell脚本.所有的Jetty JAR都应该在类路径中.
So it makes no sense to build a WAR with an embedded Jetty included. If you embed Jetty then your application should be a normal JAR with a main class. If you are able to start your application via a IDE then the next step would be to build a JAR and try to start it via the command line. Create a batch file or shell script for that purpose. All the Jetty JARs should be in the classpath.
如果这一切都可以在您的本地计算机上运行,则可以将所有必需的文件(应用程序JAR,Jetty JAR和您的启动脚本)复制到您的服务器上.
If this all works on your local machine you can copy all the necessary files (application JAR, Jetty JARs and your start script) to your server.