Endpoints Framework Gradle Plugin

The Endpoints Framework Gradle plugin provides tasks and configurations to build and connect Endpoints Framework for App Engine projects. This plugin provides server-side and client-side support. The server-side plugin generates Discovery documents and OpenAPI specifications from an annotated Endpoints Framework Java project and client libraries. The client-side plugin generates client libraries when a discovery document is available.

Plugin dependency

Add the Endpoints Framework Gradle plugin dependency by using the following snippet in your build.gradle. The following snippet retrieves the dependency from Maven Central:

classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'

Server-side plugin

Add the server-side Endpoints Framework Gradle plugin using the following snippet in your build.gradle:

apply plugin: 'com.google.cloud.tools.endpoints-framework-server'

Set server-side configuration in your build.gradle by the endpointsServer closure:

endpointsServer {
  // Endpoints Framework Plugin server-side configuration
  hostname = "${projectId}.appspot.com"
}

Server-side tasks and properties

The following tasks are exposed for the server-side only.

endpointsClientLibs

This task generates endpoints client libraries based on service classes.

You can use the following properties:

Property Description
serviceClasses List of service classes (endpoints classes), this can be inferred from the `web.xml`.
clientLibDir Output directory for generated client libraries.
hostname To set the root url for the generated client libraries. For example using `hostname = myapp.appspot.com` will result in a default root url of `https://myapp.appspot.com/_ah/api`.

endpointsDiscoveryDocs

This task generates discovery documents based on service classes.

You can use the following properties:

Property Description
serviceClasses List of service classes (endpoints classes), this can be inferred from the `web.xml`.
hostname To set the root url for the generated discovery document. For example using `hostname = myapp.appspot.com` will result in a default root url of `https://myapp.appspot.com/_ah/api`.

endpointsOpenApiDocs

This task generates OpenAPI documents based on service classes.

You can use the following properties:

Property Description
serviceClasses List of service classes (endpoints classes), this can be inferred from the `web.xml`.
hostname To set the root url for the generated OpenAPI document. For example using `hostname = myapp.appspot.com` will result in the `host` url of `https://myapp.appspot.com` and `basePath` as `/_ah/api`.

Client-side plugin

To add the client-side Endpoints Framework Gradle plugin using the following in your build.gradle:

apply plugin: 'com.google.cloud.tools.endpoints-framework-client'

Set server-side configuration in your build.gradle by the endpointsClient closure:

endpointsClient {
  // client-side properties
}

Client-side properties

The client-side plugin doesn't expose tasks like the server-side plugin. Applying the client-side plugin will generate sources according to the following configuration properties.

Property Description
discoveryDocs A list of discovery docs to use when generating sources.

What's next

  • Explore the plugin code and report issues on GitHub.