Exporting Spring Boot application as JAR file in eclipse

前端 未结 2 775
盖世英雄少女心
盖世英雄少女心 2020-12-28 10:11

I\'m using the Spring STS in Eclipse to create a simple web-based spring boot project. I can run it fine in Eclipse, but when I try to export it as a JAR file I get:

2条回答
  •  天命终不由人
    2020-12-28 10:54

    Most likely, you're using the built-in Eclipse exporter to generate your jar, which only includes the target files actually produced in that project. In order to have a "fat" (standalone executable) jar, you need to use the Spring Boot Maven or Gradle plugin to "repackage" the jar.

    First, make sure that you have the repackage goal included in your build setup, then use the Maven package target. The simplest way to do this is to run mvn package from the command line (you may need to install the Maven CLI package for your OS); you can also right-click the POM in Eclipse and "Run As" to execute specific Maven operations from within Eclipse.

提交回复
热议问题