uberjar - Running Spring boot fat JAR -
c:\users\sinpik\desktop\jar\extract>java -jar packageproject-client.jar java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.springframework.boot.loader.mainmethodrunner.run(mainmethodrunner.java:53) @ java.lang.thread.run(unknown source) caused by: java.lang.noclassdeffounderror: org/springframework/boot/springapplication @ pachname.application.main(application.java:14) ... 6 more caused by: java.lang.classnotfoundexception: org.springframework.boot.springapplication @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ org.springframework.boot.loader.launchedurlclassloader.doloadclass(launchedurlclassloader.java:168) @ org.springframework.boot.loader.launchedurlclassloader.loadclass(launchedurlclassloader.java:134) @ java.lang.classloader.loadclass(unknown source) ... 7 more
i have created sample application in spring boot , running in ide. want package fat jar , run through command prompt. how do it? running using java -jar jarname.jar
. build script:
buildscript { ext { springbootversion = '1.1.9.release' } repositories { mavencentral() jcenter() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}") classpath 'eu.appsatori:gradle-fatjar-plugin:0.3' } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot' apply plugin: 'eu.appsatori.fatjar' jar { basename = 'demo' version = '0.0.1-snapshot' } fatjar{ manifest { attributes 'implementation-title': 'gradle jar file example', // 'implementation-version': version, 'main-class': 'pachname.application' } } sourcecompatibility = 1.7 targetcompatibility = 1.7 repositories { mavencentral() } dependencies { compile("org.springframework.boot:spring-boot-starter-web") testcompile("org.springframework.boot:spring-boot-starter-test") } eclipse { classpath { containers.remove('org.eclipse.jdt.launching.jre_container') containers 'org.eclipse.jdt.launching.jre_container/org.eclipse.jdt.internal.debug.ui.launcher.standardvmtype/javase-1.7' } } fatjarpreparefiles { include 'application.properties' } task wrapper(type: wrapper) { gradleversion = '1.12' }
Comments
Post a Comment