使用maven为spring创建可执行文件

时间:2016-05-15 02:10:38

标签: java eclipse spring maven executable-jar

我正在尝试制作一个spring应用程序的可执行jar。但是每当我尝试使用java -jar jar文件运行它时,我都会收到错误:

StartCoroutine(readPage("http://www.example.com"));

我正在使用

运行
Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

当我使用Eclipse运行服务器时,运行正常。这是我的pom文件:

mvn clean compile assembly:single

我知道这已经在其他线程上得到了解答,但是没有一个对我有用,我尝试从eclipse创建一个可执行的jar文件,但是还有其他问题。

1 个答案:

答案 0 :(得分:0)

我将首先从命令行运行命令,以验证应用程序是否可以从命令行运行。

mvn spring-boot:run

通常,我通过运行

来构建胖罐
mvn clean install

然后从#WORKING_DIR#/​​ target 文件夹中获取.jar文件。 希望这能为你的调试提供一些启示。