Strumento a riga di comando Cloud Endpoints Frameworks per App Engine
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
In questa pagina viene descritto come generare una libreria client dall'API del server di backend utilizzando lo strumento a riga di comando Endpoints Frameworks. Qualsiasi app Java o Android può utilizzare questa libreria per chiamare l'API.
Puoi generare bundle di librerie client che consentono alle applicazioni di accedere alla tua API utilizzando lo strumento a riga di comando Endpoints Frameworks. Quando
generi una libreria client, lo strumento a riga di comando Endpoints Frameworks
genera automaticamente un
documento di rilevamento
che descrive l'interfaccia della tua API.
Per ottenere lo strumento a riga di comando Endpoints Frameworks, scarica
endpoints-framework-tools
dal Maven Central Repository.
Dopo aver estratto i contenuti del file ZIP, lo strumento si trova nella directory endpoints-framework-tools-2.2.1/bin/.
Generazione di un bundle di librerie client da un'API
Puoi utilizzare lo strumento a riga di comando Endpoints Frameworks per generare i seguenti tipi di bundle client:
Maven: questo bundle include un file pom.xml con le dipendenze dei framework di endpoint e della libreria client dell'API di Google.
Il file readme.html fornisce informazioni dettagliate su cosa aggiungere al file readme.html per diversi tipi di applicazioni client e su come creare una libreria client per la tua API utilizzando Maven.pom.xml
Gradle: questo bundle include un file build.gradle con le dipendenze dei framework Endpoints e della libreria client delle API di Google.
Il file readme.html fornisce informazioni dettagliate su cosa aggiungere al file readme.html per diversi tipi di applicazioni client e su come creare una libreria client per la tua API utilizzando Gradle.build.gradle
Bundle client predefinito: questo bundle contiene tutte le librerie delle dipendenze e il file source.jar generato, ovvero la libreria Java che utilizzi nel client per chiamare l'API. Questo bundle fornisce al tuo client tutte le funzionalità della libreria client delle API di Google, incluso OAuth. Il
file readme.html elenca i file .jar richiesti per diversi
tipi di applicazioni client e altri dettagli per l'utilizzo della libreria client.
Se utilizzi la libreria client con un'app per Android, ti consigliamo di utilizzare un bundle client Gradle.
Sintassi della riga di comando
Prima di utilizzare lo strumento a riga di comando Endpoints Frameworks, devi compilare il progetto di backend perché questo strumento richiede file binari compilati. Se non vuoi utilizzare il valore predefinito (--war="./war"), puoi fornire facoltativamente l'opzione --war= che rimanda alla directory di output del target di compilazione contenente la directory WEB-INF e le classi Java compilate.
dove target/echo-1.0-SNAPSHOT è il percorso relativo o assoluto della directory di compilazione di destinazione contenente WEB-INF e le classi di backend compilate.
Opzioni
Puoi utilizzare le seguenti opzioni:
Nome opzione
Descrizione
Esempio
build-system
Consente di specificare il tipo di bundle del client da produrre. Specifica gradle per un bundle client Gradle per Android, maven per un bundle client Maven o default (oppure ometti semplicemente questa opzione) per un bundle che contiene solo le librerie delle dipendenze e il file jar di origine.
--build-system=gradle -bs gradle
war
Imposta il percorso della directory di destinazione della compilazione WEB-INF che contiene appengine-web.xml e altri metadati. Valore predefinito: ./war.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThe Endpoints Frameworks command-line tool generates client library bundles, enabling Java or Android apps to access backend server APIs.\u003c/p\u003e\n"],["\u003cp\u003eThis tool automatically generates a Discovery document that outlines the API's structure, which is crucial for client interactions.\u003c/p\u003e\n"],["\u003cp\u003eClient library bundles can be generated in Maven, Gradle, or default formats, with each format catering to different project setups and providing necessary dependencies and build instructions.\u003c/p\u003e\n"],["\u003cp\u003eThe command-line tool requires compiled backend project binaries and allows options for specifying the build system, war directory, and output location, making customization easy.\u003c/p\u003e\n"],["\u003cp\u003eThe generated client libraries are compatible with Java 7+, Android 1.6+, and App Engine, ensuring wide applicability.\u003c/p\u003e\n"]]],[],null,["# Cloud Endpoints Frameworks for App Engine command-line tool\n\nThis page describes how to generate a client library from your backend server API by using the Endpoints Frameworks command-line tool. Any Java or Android app can use this library to call the API.\n\nYou can generate client library bundles that allow applications to access your\nAPI using the Endpoints Frameworks command-line tool. When you\ngenerate a client library, the Endpoints Frameworks command-line tool\nautomatically generates a\n[Discovery document](https://developers.google.com/discovery/v1/reference/apis)\nthat describes the surface of your API.\n\nTo get the Endpoints Frameworks command-line tool, download\n[`endpoints-framework-tools`](http://search.maven.org/remotecontent?filepath=com/google/endpoints/endpoints-framework-tools/2.2.1/endpoints-framework-tools-2.2.1.zip)\nfrom the [Maven Central Repository](http://search.maven.org/).\nAfter you extract the contents of the zip file, the tool is in the\n`endpoints-framework-tools-2.2.1/bin/` directory.\n\nGenerating a client library bundle from an API\n----------------------------------------------\n\nYou can use the Endpoints Frameworks command-line tool to generate the\nfollowing types of client bundles:\n\n- Maven: This bundle includes a `pom.xml` file with the\n Endpoints Frameworks and Google API Client Library dependencies.\n The `readme.html` file provides detailed information on what you need to add\n to your `pom.xml` file for different types of client\n applications and how to build a client library for your API using Maven.\n\n- Gradle: This bundle includes a `build.gradle` file with the\n Endpoints Frameworks and Google API Client Library dependencies.\n The `readme.html` file provides detailed information on what you need to add\n to your `build.gradle` file for different types of client applications and\n how to build a client library for your API using Gradle.\n\n- Default client bundle: This bundle contains all the dependency libraries and\n the generated `source.jar` file, which is the Java library that you use in\n your client to call your API. This bundle provides your client with all of\n the Google API Client Library capabilities, including OAuth. The\n `readme.html` file lists the `.jar` files that are required for different\n types of client applications and other details for using the client library.\n\nIf you are using the client library with an Android app, we recommend that you\nuse a Gradle client bundle.\n\n### Command-line syntax\n\nBefore you use the Endpoints Frameworks command-line tool, you must\nbuild your backend project because this tool requires compiled binaries. You can\noptionally supply the `--war=` option pointing to the build target output\ndirectory containing the `WEB-INF` directory and compiled java classes if you\ndon't want to use the default (`--war=\"./war\"`).\n\nThe basic syntax is as follows: \n\n```\n/path-to/endpoints-framework-tools-2.2.1/bin/endpoints-framework-tools \\\n get-client-lib OPTIONS CLASS_NAME\n```\n\nwhere:\n\n- \u003cvar translate=\"no\"\u003eOPTIONS\u003c/var\u003e, if supplied, is one or more items shown in the [Options table](#options).\n- \u003cvar translate=\"no\"\u003eCLASS_NAME\u003c/var\u003e is the fully qualified class name of your API.\n\nFor example: \n\n /path-to/endpoints-framework-tools-2.2.1/bin/endpoints-framework-tools \\\n get-client-lib --war=target/echo-1.0-SNAPSHOT -bs gradle com.example.echo.Echo\n\nwhere `target/echo-1.0-SNAPSHOT` is the relative or absolute path to the\ntarget build directory containing `WEB-INF` and the compiled backend classes.\n| **Note:** If your API is implemented from multiple classes, specify each of them separated by a space.\n\n### Options\n\nYou can use the following options:\n\n\n### Supported client platforms\n\nThe following platforms are supported in the client bundle produced by the\nEndpoints Frameworks command-line tool:\n\n- Java 7 and higher:\n- [Android](https://github.com/googleapis/google-api-java-client/wiki/Android) 1.6 and higher.\n- [App Engine](https://github.com/googleapis/google-api-java-client/wiki)."]]