From 8f9882a419fad6a792d7018a5eff4a964536ece9 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Wed, 19 Sep 2018 13:20:41 +0000 Subject: [PATCH] Going back to snapshots --- README.adoc | 8 ++- docs/pom.xml | 2 +- pom.xml | 6 +- spring-cloud-function-adapters/pom.xml | 2 +- .../spring-cloud-function-adapter-aws/pom.xml | 2 +- .../README.adoc | 61 ++++++++----------- .../pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-function-compiler/pom.xml | 2 +- spring-cloud-function-context/pom.xml | 2 +- spring-cloud-function-core/pom.xml | 2 +- spring-cloud-function-dependencies/pom.xml | 4 +- spring-cloud-function-deployer/pom.xml | 2 +- .../src/it/support/pom.xml | 4 +- .../function-sample-aws/pom.xml | 4 +- .../function-sample-azure/pom.xml | 2 +- .../function-sample-compiler/pom.xml | 4 +- .../function-sample-pof/pom.xml | 4 +- .../function-sample-pojo/pom.xml | 4 +- .../function-sample-task/pom.xml | 4 +- .../function-sample/pom.xml | 4 +- spring-cloud-function-samples/pom.xml | 2 +- spring-cloud-function-task/pom.xml | 2 +- spring-cloud-function-web/pom.xml | 2 +- spring-cloud-starter-function-web/pom.xml | 2 +- spring-cloud-starter-function-webflux/pom.xml | 2 +- 26 files changed, 68 insertions(+), 69 deletions(-) diff --git a/README.adoc b/README.adoc index db227d7fe..4bf63fd4c 100644 --- a/README.adoc +++ b/README.adoc @@ -183,10 +183,16 @@ http://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs should also work without issue as long as they use Maven 3.3.3 or better. ==== Importing into eclipse with m2eclipse + We recommend the http://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with eclipse. If you don't already have m2eclipse installed it is available from the "eclipse marketplace". +Also, you will need to install Kotlin plug-in from the "eclipse marketplace" to ensure projects +that depend on Kotlin complile under `m2eclipse` plugin (mentioned above). + +NOTE: If you still see compile errors after installing Kotlin plugin, simply right-click on the project with error and _remove_ and then _add_ Kotlin Nature via ***Configure Kotlin*** feature. + NOTE: Older versions of m2e do not support Maven 3.3, so once the projects are imported into Eclipse you will also need to tell m2eclipse to use the right profile for the projects. If you @@ -254,4 +260,4 @@ added after the original pull request but before a merge. other target branch in the main project). * When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit - message (where XXXX is the issue number). \ No newline at end of file + message (where XXXX is the issue number). diff --git a/docs/pom.xml b/docs/pom.xml index ef4a6950a..238b06a23 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT pom Spring Cloud Function Docs diff --git a/pom.xml b/pom.xml index b242b540e..ee4f563d9 100644 --- a/pom.xml +++ b/pom.xml @@ -4,13 +4,13 @@ spring-cloud-function-parent Spring Cloud Function Parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT pom org.springframework.cloud spring-cloud-build - 2.1.0.M2 + 2.1.0.BUILD-SNAPSHOT @@ -18,7 +18,7 @@ 1.8 2.0.0.RELEASE 1.0.12.RELEASE - 2.1.0.M3 + 2.1.0.BUILD-SNAPSHOT spring-cloud-function Californium-RC1 diff --git a/spring-cloud-function-adapters/pom.xml b/spring-cloud-function-adapters/pom.xml index 25d3989cc..8999ff418 100644 --- a/spring-cloud-function-adapters/pom.xml +++ b/spring-cloud-function-adapters/pom.xml @@ -9,7 +9,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT spring-cloud-function-adapter-parent diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml index 3692fe84f..086f89bf0 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml @@ -12,7 +12,7 @@ org.springframework.cloud spring-cloud-function-adapter-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc index bf93ca31a..2e297ddcc 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc @@ -3,44 +3,31 @@ This project provides an adapter layer for a Spring Cloud Function application onto Azure. You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right. -This project provides an adapter layer for a Spring Cloud Function application onto Azure. -You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right. +There is a `AzureSpringBootRequestHandler` which you must extend, and provide the input and output types as annotated method parameters (enabling Azure to inspect the class and create JSON bindings). The base class has two useful methods (`handleRequest` and `handleOutput`) to which you can delegate the actual function call, so mostly the function will only ever have one line. -The adapter has a generic HTTP request handler that you can use optionally. -There is a `AzureSpringBootRequestHandler` which you must extend, and provide the input and output types as type parameters (enabling Azure to inspect the class and do the JSON conversions itself). +Example: -If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name`. -The functions are extracted from the Spring Cloud `FunctionCatalog`. - -=== Notes on JAR Layout - -You don't need the Spring Cloud Function Web at runtime in Azure, so you need to exclude this before you create the JAR you deploy to Azure. -A function application on Azure has to be shaded, but a Spring Boot standalone application does not, so you can run the same app using 2 separate jars (as per the sample here). -The sample app creates the shaded jar file, with an `azure` classifier for deploying in Azure. - -=== JSON Configuration - -The Azure tooling needs to find some JSON configuration files to tell it how to deploy and integrate the function (e.g. which Java class to use as the entry point, and which triggers to use). Those files can be created with the Maven plugin for a non-Spring function, but the tooling doesn't work yet with the adapter in its current form. There is an example `function.json` in the sample which hooks the function up as an HTTP endpoint: - -``` -{ - "scriptFile" : "../function-sample-azure-2.0.0.BUILD-SNAPSHOT-azure.jar", - "entryPoint" : "example.FooHandler.execute", - "bindings" : [ { - "type" : "httpTrigger", - "name" : "foo", - "direction" : "in", - "authLevel" : "anonymous", - "methods" : [ "get", "post" ] - }, { - "type" : "http", - "name" : "$return", - "direction" : "out" - } ], - "disabled" : false +```java +public class FooHandler extends AzureSpringBootRequestHandler { + @FunctionName("uppercase") + public Bar execute( + @HttpTrigger(name = "req", methods = { HttpMethod.GET, + HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) + Foo foo, + ExecutionContext context) { + return handleRequest(foo, context); + } } ``` +This Azure handler will delegate to a `Function` bean (or a `Function,Publisher>`). Some Azure triggers (e.g. `@CosmosDBTrigger`) result in a input type of `List` and in that case you can bind to `List` in the Azure handler, or `String` (the raw JSON). The `List` input delegates to a `Function` with input type `Map`, or `Publisher` or `List` of the same type. The output of the `Function` can be a `List` (one-for-one) or a single value (aggregation), and the output binding in the Azure declaration should match. + +If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name`. Or if you make the `@FunctionName` in the Azure handler method match the function name it should work that way (also for function apps with multiple functions). The functions are extracted from the Spring Cloud `FunctionCatalog`. + +=== Notes on JAR Layout + +You don't need the Spring Cloud Function Web at runtime in Azure, so you can optionally exclude this before you create the JAR you deploy to Azure. +A function application on Azure is an archive generated by the Maven plugin. The function lives in the JAR file generated by this project. The sample creates it as an executable jar, using the thin layout, so that Azure can find the handler classes. If you prefer you can just use a regular flat JAR file. The dependencies should *not* be included. == Build @@ -58,7 +45,13 @@ You can run the sample locally, just like the other Spring Cloud Function sample and `curl -H "Content-Type: text/plain" localhost:8080/function -d '{"value": "hello foobar"}'`. -You will need the `az` CLI app and some node.js fu (see https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven for more detail). To deploy the function on Azure runtime: +Or you can run locally in an Azure host: + +--- +./mvnw azure-functions:run +--- + +You will need the `az` and `func` CLI apps (see https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven for more detail). To deploy the function on Azure runtime: ---- $ az login diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml index 322076287..01dfb533f 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-function-adapter-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml index d4f7a6c95..78a1387f2 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml @@ -12,7 +12,7 @@ org.springframework.cloud spring-cloud-function-adapter-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-compiler/pom.xml b/spring-cloud-function-compiler/pom.xml index 1ad9c1d1e..b5bc7ea39 100644 --- a/spring-cloud-function-compiler/pom.xml +++ b/spring-cloud-function-compiler/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-context/pom.xml b/spring-cloud-function-context/pom.xml index db4670b5e..79bb9cc66 100644 --- a/spring-cloud-function-context/pom.xml +++ b/spring-cloud-function-context/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT 1.2.61 diff --git a/spring-cloud-function-core/pom.xml b/spring-cloud-function-core/pom.xml index f5ea59262..b8dc8b992 100644 --- a/spring-cloud-function-core/pom.xml +++ b/spring-cloud-function-core/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-dependencies/pom.xml b/spring-cloud-function-dependencies/pom.xml index fa36388a2..e45546512 100644 --- a/spring-cloud-function-dependencies/pom.xml +++ b/spring-cloud-function-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.1.0.M2 + 2.1.0.BUILD-SNAPSHOT spring-cloud-function-dependencies - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT pom Spring Cloud Function Dependencies Spring Cloud Function Dependencies diff --git a/spring-cloud-function-deployer/pom.xml b/spring-cloud-function-deployer/pom.xml index 4f66780df..b067ae2b2 100644 --- a/spring-cloud-function-deployer/pom.xml +++ b/spring-cloud-function-deployer/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-deployer/src/it/support/pom.xml b/spring-cloud-function-deployer/src/it/support/pom.xml index 25aa064c2..823acf6de 100644 --- a/spring-cloud-function-deployer/src/it/support/pom.xml +++ b/spring-cloud-function-deployer/src/it/support/pom.xml @@ -11,13 +11,13 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 2.0.3.RELEASE 1.8 - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT 1.0.12.RELEASE diff --git a/spring-cloud-function-samples/function-sample-aws/pom.xml b/spring-cloud-function-samples/function-sample-aws/pom.xml index 71095f5c1..b75d66c74 100644 --- a/spring-cloud-function-samples/function-sample-aws/pom.xml +++ b/spring-cloud-function-samples/function-sample-aws/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 2.0.3.RELEASE @@ -25,7 +25,7 @@ 1.0.11.RELEASE 2.0.2 3.1.2.RELEASE - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT example.Config diff --git a/spring-cloud-function-samples/function-sample-azure/pom.xml b/spring-cloud-function-samples/function-sample-azure/pom.xml index 36eb499a8..34fe77b7b 100644 --- a/spring-cloud-function-samples/function-sample-azure/pom.xml +++ b/spring-cloud-function-samples/function-sample-azure/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 2.0.3.RELEASE diff --git a/spring-cloud-function-samples/function-sample-compiler/pom.xml b/spring-cloud-function-samples/function-sample-compiler/pom.xml index 48c13e46c..361f8fc5c 100644 --- a/spring-cloud-function-samples/function-sample-compiler/pom.xml +++ b/spring-cloud-function-samples/function-sample-compiler/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 2.0.2.RELEASE 1.8 - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT Elmhurst.RELEASE 3.1.2.RELEASE 1.0.10.RELEASE diff --git a/spring-cloud-function-samples/function-sample-pof/pom.xml b/spring-cloud-function-samples/function-sample-pof/pom.xml index 655cfc734..a09e0a6e7 100644 --- a/spring-cloud-function-samples/function-sample-pof/pom.xml +++ b/spring-cloud-function-samples/function-sample-pof/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 1.5.11.RELEASE @@ -21,7 +21,7 @@ UTF-8 1.8 3.1.2.RELEASE - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-samples/function-sample-pojo/pom.xml b/spring-cloud-function-samples/function-sample-pojo/pom.xml index 181e9f544..2740181af 100644 --- a/spring-cloud-function-samples/function-sample-pojo/pom.xml +++ b/spring-cloud-function-samples/function-sample-pojo/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 2.0.3.RELEASE 1.8 - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT 1.0.13.RELEASE diff --git a/spring-cloud-function-samples/function-sample-task/pom.xml b/spring-cloud-function-samples/function-sample-task/pom.xml index 200bead71..622dac08e 100644 --- a/spring-cloud-function-samples/function-sample-task/pom.xml +++ b/spring-cloud-function-samples/function-sample-task/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 1.5.11.RELEASE 1.8 - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT 1.0.10.RELEASE 3.1.2.RELEASE diff --git a/spring-cloud-function-samples/function-sample/pom.xml b/spring-cloud-function-samples/function-sample/pom.xml index 48dfaff36..e807ac314 100644 --- a/spring-cloud-function-samples/function-sample/pom.xml +++ b/spring-cloud-function-samples/function-sample/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.M3 + 2.1.0.BUILD-SNAPSHOT 1.8 - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT 1.0.13.RELEASE diff --git a/spring-cloud-function-samples/pom.xml b/spring-cloud-function-samples/pom.xml index 040c645bc..e8399cfcd 100644 --- a/spring-cloud-function-samples/pom.xml +++ b/spring-cloud-function-samples/pom.xml @@ -9,7 +9,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-task/pom.xml b/spring-cloud-function-task/pom.xml index bbb281b62..1438c217b 100644 --- a/spring-cloud-function-task/pom.xml +++ b/spring-cloud-function-task/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-function-web/pom.xml b/spring-cloud-function-web/pom.xml index 5fb65a60d..1fa994faa 100644 --- a/spring-cloud-function-web/pom.xml +++ b/spring-cloud-function-web/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-starter-function-web/pom.xml b/spring-cloud-starter-function-web/pom.xml index c8720a416..123b2ca80 100644 --- a/spring-cloud-starter-function-web/pom.xml +++ b/spring-cloud-starter-function-web/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-starter-function-web diff --git a/spring-cloud-starter-function-webflux/pom.xml b/spring-cloud-starter-function-webflux/pom.xml index eefbe5fdd..cdf7b4020 100644 --- a/spring-cloud-starter-function-webflux/pom.xml +++ b/spring-cloud-starter-function-webflux/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.M2 + 2.0.0.BUILD-SNAPSHOT spring-cloud-starter-function-webflux spring-cloud-starter-function-webflux