折腾:
【已解决】VSCode调试Java弹框提示:Maven executable not found in PATH Please specifiy maven.executable.path in Settings
期间,确定VSCode中用gradle。
所以此处去安装和配置。
vscode gradle
【已解决】Mac中安装Gradle
然后继续参考教程,说是要:
gradle init --type java-application
找找
vscode create build.gradle
How-To – Use Gradle inside Visual Studio Code to build your Kotlin/Native applications (on a Mac) – MartinMajewski.net
好像不用,直接新建一个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') }
还要额外设置tasks.json
apply plugin: 'java' repositories { mavenCentral() } dependencies { compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8' }
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' }
去加上试试
暂时用之前就有的maven的pom.xml。有机会再去试试gradle。