function-sample-azure cleanup

Cleaned up pom to use java.version instead of the compiler.source and
compiler.target
Added version properties for azure-functions-java-library and
azure-functions-maven-plugin
Updated the properties to be the latest recommended from Azure Functions
Used stagingDirectory in maven-resources-plugin
Updated README.adoc to say port 7071 instead of 8080
This commit is contained in:
Anthony Lofton
2019-12-12 12:54:01 -06:00
parent 0f38ea47b8
commit 75019ab281
2 changed files with 25 additions and 25 deletions

View File

@@ -4,7 +4,7 @@ You can run this sample locally, just like the other Spring Cloud Function sampl
mvn spring-boot:run mvn spring-boot:run
---- ----
and `curl -H "Content-Type: application/json" localhost:8080/uppercase -d '{"value": "hello foobar"}'`. and `curl -H "Content-Type: application/json" localhost:7071/uppercase -d '{"value": "hello foobar"}'`.
Given that our function takes POJO `Function<Foo, Bar> uppercase()` and it's input is JSON we need to Given that our function takes POJO `Function<Foo, Bar> uppercase()` and it's input is JSON we need to
provide the appropriate content-type (in this case `application/json`). provide the appropriate content-type (in this case `application/json`).

View File

@@ -19,14 +19,14 @@
</parent> </parent>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<functionAppName>function-sample-azure</functionAppName> <functionAppName>function-sample-azure</functionAppName>
<functionAppRegion>westus</functionAppRegion> <functionAppRegion>westus</functionAppRegion>
<functionResourceGroup>java-function-group</functionResourceGroup> <functionResourceGroup>java-function-group</functionResourceGroup>
<stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory> <stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
<start-class>example.Config</start-class> <start-class>example.Config</start-class>
<azure.functions.maven.plugin.version>1.3.4</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>1.3.0</azure.functions.java.library.version>
<wrapper.version>1.0.23.RELEASE</wrapper.version> <wrapper.version>1.0.23.RELEASE</wrapper.version>
</properties> </properties>
@@ -58,6 +58,11 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@@ -84,21 +89,10 @@
</filesets> </filesets>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin> <plugin>
<groupId>com.microsoft.azure</groupId> <groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId> <artifactId>azure-functions-maven-plugin</artifactId>
<version>1.3.4</version> <version>${azure.functions.maven.plugin.version}</version>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
@@ -127,6 +121,7 @@
<overWriteSnapshots>false</overWriteSnapshots> <overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer> <overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope> <includeScope>runtime</includeScope>
<excludeArtifactIds>azure-functions-java-library</excludeArtifactIds>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
@@ -139,14 +134,19 @@
<appName>${functionAppName}</appName> <appName>${functionAppName}</appName>
<region>${functionAppRegion}</region> <region>${functionAppRegion}</region>
<appSettings> <appSettings>
<property> <!-- Run Azure Function from package file by default -->
<name>FUNCTIONS_EXTENSION_VERSION</name> <property>
<value>beta</value> <name>WEBSITE_RUN_FROM_PACKAGE</name>
</property> <value>1</value>
<property> </property>
<name>MSDEPLOY_RENAME_LOCKED_FILES</name> <property>
<value>1</value> <name>FUNCTIONS_EXTENSION_VERSION</name>
</property> <value>~2</value>
</property>
<property>
<name>FUNCTIONS_WORKER_RUNTIME</name>
<value>java</value>
</property>
</appSettings> </appSettings>
</configuration> </configuration>
<executions> <executions>
@@ -170,7 +170,7 @@
<configuration> <configuration>
<overwrite>true</overwrite> <overwrite>true</overwrite>
<outputDirectory> <outputDirectory>
${project.build.directory}/azure-functions/${functionAppName} ${stagingDirectory}
</outputDirectory> </outputDirectory>
<resources> <resources>
<resource> <resource>