【发布时间】:2019-01-17 03:21:14
【问题描述】:
我正在尝试将 VS Code 用于我的 Spring Boot MVC Java 应用程序。我正在使用 Gradle 构建工具。我已经从 RedHat 安装了Java Language Support extension。每当我尝试使用“gradle bootRun”运行我的应用程序时,它似乎永远不会停止执行,但会在 75% 处停止。
此外,每当我停止任务(Ctrl+C)时,我都会收到一条消息
终端进程以退出代码终止:2。
我已将 Spring Boot 的开发工具作为依赖项包含在内,但应用程序似乎没有重新启动或重新加载。我曾尝试使用 Java 扩展提供的Force Java Recompilation 命令,但没有成功。
有没有人能够让 Spring Boot、Gradle 和 VS 代码很好地协同工作?
谢谢。
编辑:
抱歉,我应该包含我的 build.gradle 文件。
buildscript {
ext {
springBootVersion = '2.1.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id "org.kravemir.gradle.sass" version "1.2.2"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.midamcorp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 10
task ts(type:Exec) {
workingDir "./"
commandLine 'cmd', '/c', 'tscCompile.bat'
}
bootRun {
args = ["--spring.profiles.active=dev" ]
}
sass {
main {
srcDir = file("$projectDir/src/main/sass")
outDir = file("$projectDir/src/main/resources/static/css")
exclude = "**/_*.scss"
minify = true
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.postgresql:postgresql:42.2.4')
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180725.0427'
compile('com.github.mkopylec:recaptcha-spring-boot-starter:2.2.0')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
【问题讨论】:
标签: java spring-boot visual-studio-code