Sync docs from master to gh-pages
This commit is contained in:
@@ -1978,7 +1978,7 @@ public class CloudFunctionMain {
|
|||||||
<artifactId>function-maven-plugin</artifactId>
|
<artifactId>function-maven-plugin</artifactId>
|
||||||
<version>0.9.1</version>
|
<version>0.9.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<functionTarget>org.springframework.cloud.function.adapter.gcp.FunctionInvoker</functionTarget>
|
<functionTarget>org.springframework.cloud.function.adapter.gcp.GcfJarLauncher</functionTarget>
|
||||||
<port>8080</port>
|
<port>8080</port>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin></code></pre>
|
</plugin></code></pre>
|
||||||
@@ -2016,73 +2016,37 @@ public class CloudFunctionMain {
|
|||||||
You can get on the <a href="https://docs.google.com/forms/d/e/1FAIpQLScC98jGi7CfG0n3UYlj7Xad8XScvZC8-BBOg7Pk3uSZx_2cdQ/viewform">whitelist</a> to try it out.</p>
|
You can get on the <a href="https://docs.google.com/forms/d/e/1FAIpQLScC98jGi7CfG0n3UYlj7Xad8XScvZC8-BBOg7Pk3uSZx_2cdQ/viewform">whitelist</a> to try it out.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>To deploy to Google Cloud Function, you need to produce a fat jar using the Shade plugin, rather than the Spring Boot plugin.</p>
|
<p>In order to use the adapter, first add the dependency to your pom.xml:</p>
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>First, if you already have the Spring Boot plugin in your <code>pom.xml</code>, <strong>remove</strong> it:</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="listingblock">
|
<div class="listingblock">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><!-- Remove this block by deleting or commenting it out -->
|
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><dependency>
|
||||||
<!--
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<plugin>
|
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</dependency></code></pre>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
--></code></pre>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>Then, <strong>add</strong> the Shade Plugin configuration to generate a fat jar when you run the <code>mvn package</code> command.</p>
|
<p>Then, add the <code>spring-boot-maven-plugin</code> with <code>spring-cloud-function-adapter-gcp</code> as a dependency.
|
||||||
|
The extra dependency is used for <code>spring-boot-maven-plugin</code> to package your function in the correct JAR format for deployment on Google Cloud Functions.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="listingblock">
|
<div class="listingblock">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><plugin>
|
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<executions>
|
<configuration>
|
||||||
<execution>
|
<outputDirectory>target/deploy</outputDirectory>
|
||||||
<phase>package</phase>
|
</configuration>
|
||||||
<goals>
|
<dependencies>
|
||||||
<goal>shade</goal>
|
<dependency>
|
||||||
</goals>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<configuration>
|
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
|
||||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
</dependency>
|
||||||
<outputDirectory>target/deploy</outputDirectory>
|
</dependencies>
|
||||||
<shadedClassifierName>gcp</shadedClassifierName>
|
|
||||||
<transformers>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
|
||||||
<resource>META-INF/spring.handlers</resource>
|
|
||||||
</transformer>
|
|
||||||
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
|
|
||||||
<resource>META-INF/spring.factories</resource>
|
|
||||||
</transformer>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
|
||||||
<resource>META-INF/spring.schemas</resource>
|
|
||||||
</transformer>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
||||||
<mainClass>com.example.CloudFunctionMain</mainClass>
|
|
||||||
</transformer>
|
|
||||||
</transformers>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin></code></pre>
|
</plugin></code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="admonitionblock important">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td class="icon">
|
|
||||||
<i class="fa icon-important" title="Important"></i>
|
|
||||||
</td>
|
|
||||||
<td class="content">
|
|
||||||
If both Spring Boot plugin and Shade plugin are present, Shade plugin may be shading a Spring Boot produced JAR, resulting in a Fat JAR that’s unusable in Google Cloud Function. Don’t forget to remove the Spring Boot plugin!
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>Package the application.</p>
|
<p>Package the application.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -2092,7 +2056,8 @@ If both Spring Boot plugin and Shade plugin are present, Shade plugin may be sha
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>You should see the fat jar in <code>target/deploy</code> directory.</p>
|
<p>You should see the resulting JAR in <code>target/deploy</code> directory.
|
||||||
|
This JAR is correctly formatted for deployment to Google Cloud Functions.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>Make sure that you have the <a href="https://cloud.google.com/sdk/install">Cloud SDK CLI</a> installed.</p>
|
<p>Make sure that you have the <a href="https://cloud.google.com/sdk/install">Cloud SDK CLI</a> installed.</p>
|
||||||
@@ -2103,7 +2068,7 @@ If both Spring Boot plugin and Shade plugin are present, Shade plugin may be sha
|
|||||||
<div class="listingblock">
|
<div class="listingblock">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<pre>gcloud alpha functions deploy function-sample-gcp \
|
<pre>gcloud alpha functions deploy function-sample-gcp \
|
||||||
--entry-point org.springframework.cloud.function.adapter.gcp.FunctionInvoker \
|
--entry-point org.springframework.cloud.function.adapter.gcp.GcfJarLauncher \
|
||||||
--runtime java11 \
|
--runtime java11 \
|
||||||
--trigger-http \
|
--trigger-http \
|
||||||
--source target/deploy \
|
--source target/deploy \
|
||||||
|
|||||||
Reference in New Issue
Block a user