Exporting Spring Boot application as JAR file in eclipse

前端 未结 2 772
盖世英雄少女心
盖世英雄少女心 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条回答
  •  梦毁少年i
    2020-12-28 10:36

    It is a single line command, on window 7/10 machine, with command prompt to your project folder (Inside your project workspace). I do not do with Eclipse IDE POM maven goals, but you can do with maven goal there also. ON window machine I prefer cmd.exe for exporting and running.

    mvnw clean package
    

    on unix kernel based

    ./mvnw clean package
    

    You have to go inside workspace and than to the project root folder. You will see a maven wrapper mvnw, with that you don't need to have maven installed and .mvn folder at the same level provides necessary jar for that. For a project

    D:\workspace\Zuteller Workspace\zusteller>mvnw clean package
    

    it will create zusteller-0.0.1-SNAPSHOT.jar in the target folder at the same level.

    D:\workspace\Zuteller Workspace\zusteller>java -jar target\zusteller-0.0.1-SNAPSHOT.jar
    

    You can run self-contained application(embedded Tomcat) and access at localhost:8080/your project

提交回复
热议问题