最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】VSCode中如何安装gradle和配置build.gradle

VSCode crifan 3933浏览 0评论
折腾:
【已解决】VSCode调试Java弹框提示:Maven executable not found in PATH Please specifiy maven.executable.path in Settings
期间,确定VSCode中用gradle。
所以此处去安装和配置。
vscode gradle
VSCode+Gradle搭建Java开发环境_Blues Feng的博客-CSDN博客
Gradle Tasks – Visual Studio Marketplace
Gradle compiles but vscode-java is getting compilation errors · Issue #797 · redhat-developer/vscode-java · GitHub
GitHub – lacasseio/vscode-gradle-plugin: Gradle plugin for generating Visual Studio Code IDE files
【已解决】Mac中安装Gradle
然后继续参考教程,说是要:
gradle init --type java-application
找找
vscode create build.gradle
Gradle Tasks – Visual Studio Marketplace
Ebook – Chapter 9 of Gradle
How-To – Use Gradle inside Visual Studio Code to build your Kotlin/Native applications (on a Mac) – MartinMajewski.net
https://www.martinmajewski.net/how-to-use-gradle-inside-visual-studio-code-to-build-your-kotlin-native-applications-on-a-mac/
好像不用,直接新建一个build.gradle文件即可
对于Kotlin是的最小配置是:
buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
        }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
    }
}


apply plugin: 'konan'


konan.targets = ['macbook']


konanArtifacts {
    program('hello')
}
Ebook – Chapter 9 of Gradle
还要额外设置tasks.json
creating a new VS code gradle project | Down Home Country Coding With Scott Selikoff and Jeanne Boyarsky
apply plugin: 'java'
repositories {
  mavenCentral()
}
dependencies {
  compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8'
}
vscode-javadebug-sample/build.gradle at master · kasecato/vscode-javadebug-sample · GitHub
repositories {
    mavenCentral()
}


apply plugin: 'java'


sourceCompatibility = 1.8
targetCompatibility = 1.8


compileTestJava {
    options.compilerArgs += '-parameters'
}


test {
    useJUnitPlatform()
}


dependencies {
    testImplementation('org.junit.jupiter:junit-jupiter:5.4.2')
}


wrapper {
    distributionType = Wrapper.DistributionType.ALL
    gradleVersion = '5.4.1'
}
去加上试试
GitHub – kasecato/vscode-javadebug-sample: Java Debugging sample in Visual Studio Code
暂时用之前就有的maven的pom.xml。有机会再去试试gradle。

转载请注明:在路上 » 【未解决】VSCode中如何安装gradle和配置build.gradle

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.194 seconds, using 22.02MB memory