简体   繁体   English

将 Spring 启动项目导出到可运行的 jar 文件时缺少 Eclipse 启动配置

[英]Eclipse launch configuration is missing when exporting a Spring boot project to a runnable jar file

I have a Spring boot project httpCommonInterface , and have run it in the Eclipse IDE, so I have a launch configuration for it, both in the ide, and on the <workspace>/.metadata/.plugins/org.eclipse.debug.core/.launches folder.(Also I noticed that there is a mismatch between them.)我有一个 Spring 启动项目httpCommonInterface ,并且已经在 Eclipse IDE 中运行它,所以我在 IDE 和<workspace>/.metadata/.plugins/org.eclipse.debug.core/.launches都有一个启动配置<workspace>/.metadata/.plugins/org.eclipse.debug.core/.launches文件夹。(我还注意到它们之间存在不匹配。)

在此处输入图片说明 在此处输入图片说明


The problem is when I tried to export it to a runnable jar, I can't find that configuration.问题是当我试图将它导出到一个可运行的 jar 时,我找不到那个配置。 (They are different for all these three lists!) (对于所有这三个列表,它们都是不同的!)


在此处输入图片说明

Without the configuration I can't export that project.没有配置,我无法导出该项目。 How can I fix this?我怎样才能解决这个问题?

Only Java Applications launch configurations are shown in the Runnable Jar dialog. Runnable Jar 对话框中仅显示Java 应用程序启动配置

Even if the Spring boot project has been run as a Spring boot application (and a configration file is created, and we can see the spring boot lunch configuration in the ide), we still cannot export it to a runnable jar file.即使Spring boot项目已经作为Spring boot application运行了(并且创建了一个配置文件,我们可以在ide中看到spring boot午餐的配置),我们仍然无法将其导出为可运行的jar文件。

So the solution is that we firstly run the Spring boot project as a java application , then its launch configuration is listed.所以解决方案是我们首先将 Spring boot 项目作为 java 应用程序运行,然后列出它的启动配置。


How to run the Spring boo project as a java application:如何将 Spring boo 项目作为 java 应用程序运行:

  1. right click on the project;右键单击项目;

  2. run as -> run configration ; run as -> run configration

  3. on the left part of the window, choose one instance of Java Application (if none, new one);在窗口的左侧,选择Java Application一个实例(如果没有,则new一个);

    1. config the run configration , like the Project and Main Class in the Project tab.配置run configration ,如Project选项卡中的ProjectMain Class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM