Maven plugin to compile TypeScript sources. Plugin supports TypeScript at least version 2.1.4 and older.
- Required Node.js to be installed with TypeScript module (npm i -g typescript)
- Required PATH presence for tsc (check availability by typing tsc --version)
- Required Java 1.6+
<plugin>
<groupId>ru.kgn.typescript</groupId>
<artifactId>typescript-maven-plugin</artifactId>
<version>0.5.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>tsc</goal>
</goals>
</execution>
</executions>
<configuration>
<targetDirectory>${basedir}/target/js</targetDirectory>
<sourceDirectory>${basedir}/src/main/webapp/WEB-INF/client/ts</sourceDirectory>
<module>amd</module>
<target>ES5</target>
<sources>
<source>application.ts</source>
</sources>
<sourcemap>false</sourcemap>
</configuration>
</plugin>
targetDirectory
- directory for compiled JS-files, requiredsourceDirectory
- directory with TS source files, requiredmodule
- module code generation, default value isamd
target
- version of ECMAScript, default value isES5
sources
- files to compile, requiredsourcemap
- add TS-files and JS.MAP-files to targetDirectory, default value isfalse
mvn install:install-file -Dfile=typescript-maven-plugin-0.5.1.jar
or build and install from sources:
mvn install
- Plugin has been tested on Windows (7, 10) and Linux (Ubuntu 15.04) platforms. Linux compatibility is available since 0.5.1.
- Plugin is compatible with both major versions of TypeScript: it has been tested with TS 1.6.2 (and older) and TS 2.1.4.
- Plugin supports only some subset of available compiler options but the most important subset. See Usage example section.