Endpoints Framework Gradle Plugin

This Gradle plugin provides tasks and configurations to generate Google Cloud Endpoints Framework client code and discovery docs

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

com.google.cloud.tools
ArtifactId

ArtifactId

endpoints-framework-gradle-plugin
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Endpoints Framework Gradle Plugin
This Gradle plugin provides tasks and configurations to generate Google Cloud Endpoints Framework client code and discovery docs
Project URL

Project URL

https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin
Source Code Management

Source Code Management

https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin

Download endpoints-framework-gradle-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/com.google.cloud.tools/endpoints-framework-gradle-plugin/ -->
<dependency>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>endpoints-framework-gradle-plugin</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.google.cloud.tools/endpoints-framework-gradle-plugin/
implementation 'com.google.cloud.tools:endpoints-framework-gradle-plugin:2.1.0'
// https://jarcasting.com/artifacts/com.google.cloud.tools/endpoints-framework-gradle-plugin/
implementation ("com.google.cloud.tools:endpoints-framework-gradle-plugin:2.1.0")
'com.google.cloud.tools:endpoints-framework-gradle-plugin:jar:2.1.0'
<dependency org="com.google.cloud.tools" name="endpoints-framework-gradle-plugin" rev="2.1.0">
  <artifact name="endpoints-framework-gradle-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.google.cloud.tools', module='endpoints-framework-gradle-plugin', version='2.1.0')
)
libraryDependencies += "com.google.cloud.tools" % "endpoints-framework-gradle-plugin" % "2.1.0"
[com.google.cloud.tools/endpoints-framework-gradle-plugin "2.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.google.guava : guava jar 30.1-jre
com.google.endpoints : endpoints-framework-tools jar 2.2.2

test (4)

Group / Artifact Type Version
commons-io : commons-io jar 2.8.0
org.hamcrest : hamcrest-library jar 1.3
org.mockito : mockito-core jar 2.1.0
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

project status image Maven Central

Endpoints Framework Gradle Plugin

This Gradle plugin provides tasks and configurations to build and connect Endpoints Framework projects.

Android Studio users see transition guide.

Requirements

Gradle is required to build and run the plugin.

How to use

The plugin JAR needs to be defined in the classpath of your build script. Alternatively, you can download it from GitHub and deploy it to your local repository. The following code snippet shows an example on how to retrieve it from maven central :

buildscript {
  repositories {
    mavenCentral()
  }

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

Server

In your Gradle App Engine Java app, add the following plugin to your build.gradle:

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

The plugin exposes the following server side goals

  • endpointsClientLibs - generate client libraries
  • endpointsDiscoveryDocs - generate discovery documents
  • endpointsOpenApiDocs - generate Open Api documents

The plugin exposes server side configuration through the endpointsServer extension

  • serviceClasses - List of service classes (optional), this can be inferred from web.xml
  • clientLibDir - Output directory for generated client libraries
  • hostname - To set the root url for discovery docs and client libs (ex: hostname = myapp.appspot.com will result in a default root url of https://myapp.appspot.com/_ah/api)

Usage

Make sure your web.xml is configured to expose your endpoints correctly.

No configuration paramters are required to run with default values

$> gradle endpointsClientLibs

Client libraries will be written to build/endpointsClientLibs

$> gradle endpointsDiscoveryDocs

Discovery documents will be written to build/endpointsDiscoveryDocs

Client

In your client Java app, add the following plugin to your build.gradle:

// apply this plugin after you have applied other plugins
// because it uses the state of other plugins
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'

The plugin exposes no tasks. Applying the plugin will generate sources according to your configuration

The plugin exposes client side configuration through the endpointsClient extension

  • discoveryDocs - List of discovery docs to generate source from

The plugin exposes intermodule endpoints configuration through a custom dependency

  • endpointsServer - Configure generation of source from another module in the project

Usage (from discovery docs)

In your build.gradle define the location of the discovery document in the endpointsClient configuration closure.

endpointsClient {
  discoveryDocs = ['src/endpoints/myApi-v1-rest.discovery']
}

building your project should inject the correct generated source into your compile path.

Usage (from server module in project)

In your build.gradle define the correct project dependency, the server project must be an endpoints-framework-server module for this to work.

dependencies {
  endpointsServer project(path: ":server", configuration: "endpoints")
}

building your project should inject the correct generated source into your compile path.

You can use a combination of discovery doc files and server dependencies when building a client module, make sure you include all the necessary dependencies for building your endpoints client

dependencies {
  compile 'com.google.api-client:google-api-client:<version>' // for standard java projects
  compile 'com.google.api-client:google-api-client-android:<version>' exclude module: 'httpclient' // for android projects
}

Contributing

If you wish to build this plugin from source, please see the contributor instructions.

com.google.cloud.tools

Google Cloud Platform

Versions

Version
2.1.0
2.0.1
2.0.0
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-beta9
1.0.0-beta8
1.0.0-beta7
1.0.0-beta6
1.0.0-beta5
1.0.0-beta4
1.0.0-beta3
1.0.0-beta2
1.0.0-beta