Maven kotlin js plugin


#1

Hello!

I have pom https://gist.github.com/b7w/52dfef3999c96ddf18a1

Is there any way to compile part of kotlin code into js? For example only package “com.demo.client.*” And how to set destination of output file?

Thanks


#2

You can use something like the following (see, for example, https://github.com/JetBrains/kotlin/blob/master/libraries/examples/kotlin-js-library-example/pom.xml)

<plugin>   <groupId>org.jetbrains.kotlin</groupId>   <artifactId>kotlin-maven-plugin</artifactId>   <version>${project.version}</version>   <executions>   <execution>   <id>js</id>   <phase>compile</phase>   <goals>   <goal>js</goal>   </goals>   <configuration>   <sourceDirs>src/main/kotlin</sourceDirs>  <!-- Replace with your path -->   <outputFile>${project.build.outputDirectory}/${project.artifactId}.js</outputFile>   </configuration>   </execution>   </executions> </plugin>