Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Spring Boot: How to create an executable jar

I'm trying to create an executable jar from IntelliJ.

First I got the Java Security Exception and I changed sqljdbc4-4.0 to unsigned. First problem solved.

Then I got Manifest not found. Added META-INF dir to output. Second problem solved.

Next I got the BeanCreationException (unsolved):

Caused by: org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath.

In IntelliJ it is working.

I think the resources are not in the output. (application.properties, ...)

IntelliJ Config

In which way do I add the resources or where are they stored in the jar.

I'm using gradle and on the spring boot homepage are only instructions for maven.

like image 730
rala Avatar asked Nov 08 '15 10:11

rala


2 Answers

You should use spring-boot-maven-plugin or spring-boot-gradle-plugin, depending on your preferred build system.

EDIT:

Just run ./gradlew build

I suggest to dive into this getting started guide. It clarifies a lot of stuff for beginners.

like image 191
luboskrnac Avatar answered Sep 17 '22 12:09

luboskrnac


A typical Spring boot project is a Maven project or a Gradle-Project (I only know how to do it with Maven, for Gradle see [luboskrnacs answer][1]). So you just need to run the maven targetpackageand pick the jar form the (created)target` folder

use a shell, go to the project root directory (where the pom.xml file is) and type

mvn clean package
cd target

the there is the xxx.jar file.

like image 24
Ralph Avatar answered Sep 20 '22 12:09

Ralph