从我的Maven项目的上下文运行Kotlin REPL?

我如何在Maven项目的上下文中运行Kotlin REPL?

这工作,但是很丑陋:

kotlinc-jvm -cp target/classes/:`ruby -e "puts Dir['target/**/*.jar'].join(':')"` 

我已经尝试了以下的不同变化(使用Maven复制编译器JAR作为依赖后),但没有任何工作( Error: Could not find or load main class org.jetbrains.kotlin.runner.Main ):

 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>java</executable> <arguments> <argument>-classpath</argument> <classpath/> <argument>-classpath</argument> <argument>${project.basedir}/target/dependency/kotlin-compiler-1.0.0.jar</argument> <argument>org.jetbrains.kotlin.runner.Main</argument> </arguments> </configuration> </plugin> 

请尝试使用K2JVMCompiler ,因为它现在是kotlin-compiler.jar REPL的入口点:

 <configuration> <executable>java</executable> <arguments> <argument>-classpath</argument> <classpath/> <argument>-classpath</argument> <argument>${project.basedir}/target/dependency/kotlin-compiler-1.0.0.jar</argument> <argument>org.jetbrains.kotlin.cli.jvm.K2JVMCompiler</argument> </arguments> </configuration> 
Interesting Posts