【发布时间】:2015-10-04 17:49:45
【问题描述】:
我是 gradle 新手。
我正在使用 gradle 构建一个项目。
它构建成功,没有任何错误。在运行构建 jar 文件时,它会给出classNotFoundException。
我正在从 spring.io 构建一个simple spring 项目
但是问题看起来类似于this,但是找不到解决方案。请帮忙。
编辑:这就是我的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"
}
【问题讨论】:
标签: java spring gradle classnotfoundexception