This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update endpoints archetypes with new tooling (#54)
* Updating endpoints tooling * Added gradle build support * Added endpoints v1.0 and v2.0 support to archetype * Moving and changing copyright header * Moving copyright below xml header... * Adding Test for hello-endpoints-archetype * Adding Gradle appengineDeploy to E2E tests * Updating Jenkins.sh to fail on non-zero return * Removing unnecessary paramters application/version * Removing unnecessary application/version parameters * Added -x to Jenkins.sh * Add fail on non-zero and print commands to Jenkins.sh * Set deployment version for gradle test * Removing unnecessary setup step from README * Removed eclipse-launch-profiles * Updated archetype version - removed "-0" * Removed -0 from helloendpoints pom. * Remove nbactions and eclipse profiles * Updating copyright in hellendpoints and endpointsskeleton * Removed copyright from auto-generated code * Modified velocity commented copyrights - remove whitespace. * Removed unnecessary plugins from endpoints archetypes pom.xml * Updating Jenkins.sh to be more specific to running instance * Updating READMEs for endpoints archetypes * Modifying PROJECT_ID to VERSION_ID in Jenkins.sh tests * Consolidated Jenkins.sh and archetype/Jenkins.sh * Updating endpoints archetypes READMEs with note for payment. * Cleand up pom.xml and removed unnecessary dependency * Updated Jenkins.sh to be version specific. * Updating skeleton to act more like an endpoints skeleton * Updating skeleton endpoints archetype README to reflect changes * Updating README for helloendpoints archetype * Removing unused application-id from endpoints archetypes * Adding header for endpoints archetypes README * Wrapped environment variables with double-quotes
- Loading branch information
Showing
23 changed files
with
631 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 82 additions & 34 deletions
116
endpoints-skeleton-archetype/src/main/resources/archetype-resources/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,105 @@ | ||
endpoints-skeleton | ||
================== | ||
|
||
A skeleton application for Google Cloud Endpoints in Java. | ||
#set( $symbol_pound = '#' ) | ||
#set( $symbol_dollar = '$' ) | ||
#set( $symbol_escape = '\' ) | ||
# Skeleton Google Cloud Endpoints Frameworks for App Engine using a discovery document | ||
|
||
This generated sample provides a skeleton to get started with Cloud Endpoints | ||
Frameworks for App Engine using a discovery document. This sample contains comments | ||
of how to use the prior Endpoints Frameworks as well. For clarity, the prior Endpoints | ||
Frameworks and the new Endpoints Frameworks are denoted as Endpoints Frameworks v1.0 | ||
and Endpoints Frameworks v2.0 respectively. | ||
|
||
Google Cloud Endpoints Frameworks v2.0 provides new functionality which may | ||
require payment and uses an OpenAPI specification instead of the discovery document. | ||
The OpenAPI development process is explained [here][8] and a quickstart is | ||
provided [here][9]. | ||
|
||
## Products | ||
- [App Engine][1] | ||
- [Google App Engine Standard][1] | ||
|
||
## Language | ||
- [Java][2] | ||
|
||
## APIs | ||
- [Google Cloud Endpoints][3] | ||
- [Google App Engine Maven plugin][4] | ||
- [Google Cloud Endpoints Frameworks v2.0][8] | ||
- [Google Cloud Endpoints Frameworks v1.0][3] | ||
|
||
## Setup Instructions | ||
## Build and Deployment Plugins | ||
- [Google Cloud Endpoints Frameworks Maven Plugin][10] | ||
- [Google Cloud Endpoints Frameworks Gradle Plugin][11] | ||
|
||
1. Update the value of `application` in `appengine-web.xml` to the app | ||
ID you have registered in the App Engine admin console and would | ||
like to use to host your instance of this sample. | ||
## Setup | ||
|
||
1. Add your API method to `src/main/java/${packageInPathFormat}/YourFirstAPI.java`. | ||
|
||
1. Optional step: These sub steps are not required but you need this | ||
if you want to have auth protected methods. | ||
1. [Optional]: Use Cloud Endpoints Frameworks v1.0. | ||
|
||
- Uncomment Endpoints Frameworks v1.0 sections and comment | ||
Endpoints Frameworks v2.0 sections in the following files. | ||
|
||
``` | ||
pom.xml | ||
build.gradle | ||
src/main/webapp/WEB-INF/web.xml | ||
``` | ||
## Build and Deployment | ||
### Maven | ||
1. Build a fresh binary with | ||
1. Update the values in `src/main/java/${packageInPathFormat}/Constants.java` | ||
to reflect the respective client IDs you have registered in the | ||
[APIs Console][6]. | ||
`mvn clean compile` | ||
1. You also need to supply the web client ID you have registered | ||
in the [APIs Console][4] to your client of choice (web, Android, | ||
iOS). | ||
1. Run the application locally at [localhost:8080][5] with | ||
1. Run the application with `mvn appengine:devserver`, and ensure it's | ||
running by visiting your local server's api explorer's address (by | ||
default [localhost:8080/_ah/api/explorer][5].) | ||
`mvn appengine:run` | ||
1. Get the client library with | ||
1. Explore local server's api explorer with | ||
$ mvnappengine:endpoints_get_client_lib | ||
[localhost:8080/_ah/api/explorer][5] | ||
It will generate a client library jar file under the | ||
`target/endpoints-client-libs/<api-name>/target` directory of your | ||
project, as well as install the artifact into your local maven | ||
repository. | ||
1. Generate the client library in a zip file named `helloworld-v1-java.zip` with | ||
`mvn endpoints-framework:clientLibs` | ||
1. Deploy your application to Google App Engine with | ||
$ mvn appengine:update | ||
`mvn appengine:deploy` | ||
### Gradle | ||
1. Build a fresh binary with | ||
`gradle clean compileJava` | ||
1. Run the application locally at [localhost:8080][5] with | ||
`gradle appengineRun` | ||
1. Explore local server's api explorer with | ||
[localhost:8080/_ah/api/explorer][5] | ||
1. Generate the client library in a zip file named `helloworld-v1-java.zip` with | ||
`gradle endpointsClientLibs` | ||
1. Deploy your application to Google App Engine with | ||
`gradle appengineDeploy` | ||
[1]: https://developers.google.com/appengine | ||
[1]: https://cloud.google.com/appengine/docs/java/ | ||
[2]: http://java.com/en/ | ||
[3]: https://developers.google.com/appengine/docs/java/endpoints/ | ||
[4]: https://developers.google.com/appengine/docs/java/tools/maven | ||
[5]: https://localhost:8080/_ah/api/explorer | ||
[6]: https://console.developers.google.com/ | ||
[3]: https://cloud.google.com/appengine/docs/java/endpoints/ | ||
[4]: https://cloud.google.com/appengine/docs/java/tools/maven | ||
[5]: https://localhost:8080/ | ||
[6]: https://console.developers.google.com/project/_/apiui/credential | ||
[7]: https://cloud.google.com/appengine/docs/java/endpoints/migrating | ||
[8]: https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks | ||
[9]: https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java | ||
[10]: https://github.com/GoogleCloudPlatform/endpoints-framework-maven-plugin | ||
[11]: https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin | ||
[12]: https://cloud.google.com/endpoints/docs/authenticating-users-frameworks |
72 changes: 72 additions & 0 deletions
72
endpoints-skeleton-archetype/src/main/resources/archetype-resources/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#set( $symbol_pound = '#' ) | ||
#set( $symbol_dollar = '$' ) | ||
#set( $symbol_escape = '\' ) | ||
#** | ||
Copyright 2017 Google Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*# | ||
buildscript { // Configuration for building | ||
repositories { | ||
mavenCentral() | ||
jcenter() // Bintray's repository - a fast Maven Central mirror & more | ||
} | ||
dependencies { | ||
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+' // latest App Engine Gradle tasks | ||
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:${endpoints-p}' | ||
} | ||
} | ||
|
||
repositories { // repositories for Jar's you access in your code | ||
maven { | ||
url 'https://oss.sonatype.org/content/repositories/snapshots' // SNAPSHOT Repository (if needed) | ||
} | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
apply plugin: 'java' // standard Java tasks | ||
apply plugin: 'war' // standard Web Archive plugin | ||
apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks | ||
apply plugin: 'com.google.cloud.tools.endpoints-framework-server' | ||
|
||
dependencies { | ||
providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5' | ||
compile 'jstl:jstl:1.2' | ||
compile group: 'javax.inject', name: 'javax.inject', version: '1' | ||
|
||
// Uncomment to use Endpoints Frameworks v1.0 | ||
// compile group: 'com.google.appengine', name: 'appengine-endpoints', version: '1.9.48' | ||
// End of Endpoints Frameworks v1.0 | ||
|
||
// Endpoints Frameworks v2.0 | ||
compile "com.google.endpoints:endpoints-frameworks:${endpoints-fw}" | ||
// End of Endpoints Frameworks v2.0 | ||
} | ||
|
||
appengine { // App Engine tasks configuration | ||
run { // local (dev_appserver) configuration (standard environments only) | ||
|
||
} | ||
|
||
deploy { // deploy configuration | ||
|
||
} | ||
} | ||
|
||
group = "${groupId}" // Generated output GroupId | ||
version = "1" // Version in generated output | ||
|
||
sourceCompatibility = 1.7 // App Engine Standard uses Java 7 | ||
targetCompatibility = 1.7 // App Engine Standard uses Java 7 |
17 changes: 0 additions & 17 deletions
17
...hetype/src/main/resources/archetype-resources/eclipse-launch-profiles/DevAppServer.launch
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...e/src/main/resources/archetype-resources/eclipse-launch-profiles/UpdateApplication.launch
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.