Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Purpose

This maven plugin is part of the java2typescript project. It generates a typescript definition of REST services and corresponding DTO model out of JAX-RS annotated Java services.

Goals

There is a single goal generate that generates both .ts and .js files

mvn java2typescript:generate

Parameters

Here are the parameters handled by the plugin

Name Expression Default value Meaning
serviceClass j2ts.serviceClass - Class of REST service
moduleName j2ts.moduleName - Name of output module
tsOutFolder j2ts.tsOutFolder ${project.build.directory} Output folder for ts file
jsOutFolder j2ts.jsOutFolder ${project.build.directory} Output folder for js file

By default the two files will be generated as :

  • <tsOutFolder>/<moduleName>.d.ts
  • <jsOutFolder>/<moduleName>.js

Setup

To use this plugin, you first need to declare a custom repository :

    <pluginRepositories>
        <pluginRepository>
            <id>jitpack.io2</id>
            <name>jitpack.io Plugin Repository</name>
            <url>https://jitpack.io</url>
            <layout>default</layout>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <updatePolicy>always</updatePolicy>
            </releases>
        </pluginRepository>
    </pluginRepositories>

and add the plugin:

	<build>
		<plugins>
            <plugin>
                <groupId>com.github.raphaeljolivet.java2typescript</groupId>
                <artifactId>java2typescript-maven-plugin</artifactId>
                <version>FIXME-change-the-version</version>
                <configuration>
                    <!-- FIXME see the configuration parameters above -->
                    <serviceClass>com.example.rs.PeopleRestService</serviceClass>
                    <moduleName>People</moduleName>
                </configuration>
			</plugin>
		</plugins>
	</build>

Note, that You should change the configuration properties (see above) and plugin version (take a look at installation instructions from parent project)