折腾:
【已解决】VSCode调试Java弹框提示:Maven executable not found in PATH Please specifiy maven.executable.path in Settings
期间,确定VSCode中用gradle。
所以此处去安装和配置。
vscode gradle
【已解决】Mac中安装Gradle
然后继续参考教程,说是要:
1 | 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是的最小配置是:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | buildscript { repositories { mavenCentral() maven { } } dependencies { classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+" } } apply plugin: 'konan' konan.targets = [ 'macbook' ] konanArtifacts { program( 'hello' ) } |
还要额外设置tasks.json
1 2 3 4 5 6 7 | apply plugin: 'java' repositories { mavenCentral() } dependencies { compile group: 'org.apache.commons' , name: 'commons-lang3' , version: '3.8' } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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。