Skip to content

Latest commit

 

History

History
86 lines (58 loc) · 2.64 KB

README.md

File metadata and controls

86 lines (58 loc) · 2.64 KB

Swift Maven Plugin

Generate thrift IDL from Swift compatible java code.

Usage

Add the plugin to the build plugins section of the pom.

<build>
    <plugins>
        <plugin>
            <groupId>com.github.rojanu</groupId>
            <artifactId>swift2thrift-maven-plugin</artifactId>
            <version>0.1-SNAPSHOT</version>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <idlFile>mame-of-generated.idl</idlFile>
                <javaPackage>com.package.pojo.to.be.thrift</javaPackage>
                <swiftClassNames>
                    <swiftClassName>com.package.pojo.long.package.ClassName</swiftClassName>
                    <swiftClassName>com.package.pojo.OtherClassName</swiftClassName>
                </swiftClassNames>
            </configuration>
        </plugin>
    </plugins>
</build>

Additional help can be displayed with mvn com.github.rojanu:swift2thrift-maven-plugin:help.

Supported configuration parameters

skip

Skip the plugin completely. Can be used to turn plugin execution on or off.

skip is optional, default is "false".

<skip>true|false</skip>

idlFile

Name of the IDL file to be generatd

idFile must be defined in the POM, otherwise the plugin will report an error.

<idlFile>mame-of-generated.idl</idlFile>

outputFolder

Determines the output folder for the generated sources.

outputFolder is optional with a default of ${project.build.directory}/generated-sources/thrift.

javaPackage

Allow input classes to reside in different packages. The value of this flag defines the generated java.swift namespace. Note that Swift classes generated from the resultant Thrift file will all reside in one Java package

javaPackage must be defined in the POM, otherwise the plugin will report an error.

<javaPackage>com.package.pojo.to.be.thrift</javaPackage>

swiftClassNames

A list of Swift compatible Java classes to be included in generated IDL file

swiftClassNames must be defined in the POM, otherwise the plugin will report an error.

<swiftClassNames>
  <swiftClassName>com.package.pojo.long.package.ClassName</swiftClassName>
  <swiftClassName>com.package.pojo.OtherClassName</swiftClassName>
  ...
</swiftClassNames>

Maven lifecycle

The generate goal of the plugin is by default hooked into the generate-sources phase of the maven lifecycle.