Installation
guardrail is available as a modular core, with both sbt and Maven integration. The core can also be run as a stand-alone CLI application, with full support for all features.
guardrail for Dropwizard is generally set up using the maven plugin. This will generate your server or client at build time.
The following is an example invocation in a pom.xml
file:
<build>
<plugins>
<plugin>
<groupId>com.twilio</groupId>
<artifactId>guardrail-maven-plugin_2.12</artifactId>
<version>0.62.0</version>
<executions>
<execution>
<id>generate-app-server</id>
<goals>
<goal>generate-sources</goal>
</goals>
<configuration>
<language>java</language>
<framework>dropwizard</framework>
<kind>server</kind>
<specPath>server-spec.yaml</specPath>
<packageName>demowizard.generated</packageName>
</configuration>
</execution>
</executions>
</plugin>
(...)
</plugins>
</build>
For JDK9+ you also need to add javax.annotation:javax.annotation-api
dependency:
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>