Gradle build successfully, error is running jar

I am new to gradle.

I am building a project using gradle. It builds successfully without errors. When running the build jar file, it provides classNotFoundException

.

enter image description here

I am creating a simple spring project from spring.io

However the question is similar to this one but couldn't find a solution. Please, help.

edit: This is how mine looks like build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar {
    baseName = 'gs-rest-service'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

startScripts {
  mainClassName = 'Application'
}

springBoot {
  mainClass = "Application"
}

      

+3


source to share


1 answer


You will need to launch the application using the generated startup scripts. They will automatically take care of setting up the correct classpath.



+1


source







All Articles