Generating Javascript and Java using maven

Hi,

Is it possible to generate java and javascript in maven as follows:

<plugin>
        <artifactId>kotlin-maven-plugin</artifactId>
        <groupId>org.jetbrains.kotlin</groupId>
        <version>${kotlin.version}</version>
        <executions>
          <execution>
            <id>compile</id>
            <goals>
              <goal>compile</goal>
              <goal>js</goal>
            </goals>
            <configuration>
              <sourceDirs>
                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                <sourceDir>${project.basedir}/src/main/java</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
          <execution>
            <id>test-compile</id>
            <goals> <goal>test-compile</goal> </goals>
            <configuration>
              <sourceDirs>
                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                <sourceDir>${project.basedir}/src/test/java</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
        </executions>
      </plugin>

I don’t seem to be able to do it as I am getting the following problems:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.112 s
[INFO] Finished at: 2017-01-31T17:30:43+00:00
[INFO] Final Memory: 53M/568M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.0.6:js (compile) on project em-commonlib: Compilation failure: Compilation failure:
[ERROR] /Users/rui/em/em-commonlib/src/main/kotlin/com/equalsmagic/common/MapRowCol.kt:[19,18] Unresolved reference: Math
[ERROR] /Users/rui/em/em-commonlib/src/main/kotlin/com/equalsmagic/common/MapRowCol.kt:[49,28] Unresolved reference: Integer
[ERROR] /Users/rui/em/em-commonlib/src/main/kotlin/com/equalsmagic/common/MapRowCol.kt:[58,5] Unresolved reference: println
[ERROR] /Users/rui/em/em-commonlib/src/main/kotlin/com/equalsmagic/common/MapRowCol.kt:[59,5] Unresolved reference: println
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Thanks!

~rui.

According to my experience and logic, you can’t do it. JavaScript builds from kotlin with Kotlin JavaScript SDK, so you can’t use anything else from JVM besides some java.util Javascript sdk provides