Tag: 雄猫

如何在eclipse maven web项目中编译kotlin

我用了 日食火星 jdk8 tomcat8 kotlin 1.0 即时处理java-> kotlin在spring项目 我在pom.xml中添加这个代码 1.0.0 … org.jetbrains.kotlin kotlin-stdlib ${kotlin.version} …. maven-eclipse-plugin 2.9 org.springframework.ide.eclipse.core.springnature org.springframework.ide.eclipse.core.springbuilder true true org.apache.maven.plugins maven-compiler-plugin 2.5.1 1.6 1.6 -Xlint:all true true org.codehaus.mojo exec-maven-plugin 1.2.1 org.test.int1.Main org.jetbrains.kotlin kotlin-maven-plugin ${kotlin.version} compile process-sources compile src/main/kotlin test-compile process-test-sources test-compile src/test/kotlin 但是当tomcat启动或创建为war文件时,不要将.kt文件进行complile .kt和.java文件在同一个包中混合使用 顺便说一句,当你启动tomcat或创建war文件,.java文件被编译但.kt文件不是 因此在WEB-INF / classes目录中存在.class(是.java的结果)和.kt文件(不是编译的) 这张图片是WEB-INF / classes目录 类文件夹 如何编译.kt文件?