Azure Functions项目在Visual Studio Code中使用,使用Java。

huangapple go评论113阅读模式
英文:

Azure Functions project using Visual Studio Code in java

问题

以下是翻译好的部分:

我尝试使用VSCode创建Azure函数并将其部署到Azure。我按照官方文档中的描述进行操作,

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?pivots=programming-language-java.

在这份文档中按照描述做了一切,但是在达到“本地运行函数”部分时按下F5时出现了错误。我在互联网上搜索了一些方法,但没有一个有效。我注意到在官方GitHub账户上有一个开放的问题,早在2017年就已经报告了,

https://github.com/Microsoft/function-demo-java-on-azure/issues/3

这让我想知道这个问题是否仍然存在?

我已经在这上面花了很多时间,但无法使其工作。任何帮助都将不胜感激。

环境:
VS Code:v1.44.0
jdk 11.0.3
node v12.16.1
maven v3.6.3

使用命令成功安装了Azure函数核心工具,命令为 npm install -g azure-functions-core-tools@3

以下是完整的错误追踪信息:

[INFO] --- azure-functions-maven-plugin:0.1.4:package (package-functions) @ azure-http-trigger-example ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.933 s
[INFO] Finished at: 2020-04-10T17:28:19-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package (package-functions) on project azure-http-trigger-example: Execution package-functions of goal com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package failed: A required class was missing while executing com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package: javax/xml/bind/JAXBException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>com.microsoft.azure:azure-functions-maven-plugin:0.1.4
...(省略部分内容)

终端进程已终止,退出码为:1

终端将被任务重用,请按任意键关闭它。

如果您有更多问题或需要进一步帮助,请随时提问。

英文:

I am trying to use VSCode to create azure function and deploy it to azure. I followed the official documentation as described,

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?pivots=programming-language-java.

did everything as described in this document but got the error on pressing F5 upon reaching the section 'Run the function locally'. I tried few things by searching on internet but none of them work. I noticed there is an open issue on official github account reported way back in 2017

https://github.com/Microsoft/function-demo-java-on-azure/issues/3

That makes me wonder is this problem still exist?

Already spent lots of time on this but couldn't make it to work. Any help is appreciated

  1. Environment:
  2. VS Code: v1.44.0
  3. jdk 11.0.3
  4. node v12.16.1
  5. maven v3.6.3

successfully installed the azure function core tools using the command, npm install -g azure-functions-core-tools@3

Here is complete error trace

  1. INFO] --- azure-functions-maven-plugin:0.1.4:package (package-functions) @ azure-http-trigger-example ---
  2. [INFO] ------------------------------------------------------------------------
  3. [INFO] BUILD FAILURE
  4. [INFO] ------------------------------------------------------------------------
  5. [INFO] Total time: 18.933 s
  6. [INFO] Finished at: 2020-04-10T17:28:19-04:00
  7. [INFO] ------------------------------------------------------------------------
  8. [ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package (package-functions) on project azure-http-trigger-example: Execution package-functions of goal com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package failed: A required class was missing while executing com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package: javax/xml/bind/JAXBException
  9. [ERROR] -----------------------------------------------------
  10. [ERROR] realm = plugin>com.microsoft.azure:azure-functions-maven-plugin:0.1.4
  11. [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
  12. [ERROR] urls[0] = file:/C:/maven/repository/com/microsoft/azure/azure-functions-maven-plugin/0.1.4/azure-functions-maven-plugin-0.1.4.jar
  13. [ERROR] urls[1] = file:/C:/maven/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
  14. [ERROR] urls[2] = file:/C:/maven/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.0/org.eclipse.sisu.inject-0.3.0.jar
  15. [ERROR] urls[3] = file:/C:/maven/repository/org/apache/maven/maven-builder-support/3.3.3/maven-builder-support-3.3.3.jar
  16. [ERROR] urls[4] = file:/C:/maven/repository/org/eclipse/aether/aether-util/1.0.2.v20150114/aether-util-1.0.2.v20150114.jar
  17. [ERROR] urls[5] = file:/C:/maven/repository/org/sonatype/sisu/sisu-guice/3.2.5/sisu-guice-3.2.5-no_aop.jar
  18. [ERROR] urls[6] = file:/C:/maven/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
  19. [ERROR] urls[7] = file:/C:/maven/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
  20. [ERROR] urls[8] = file:/C:/maven/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
  21. [ERROR] urls[9] = file:/C:/maven/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
  22. [ERROR] urls[10] = file:/C:/maven/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
  23. [ERROR] urls[11] = file:/C:/maven/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
  24. [ERROR] urls[12] = file:/C:/maven/repository/com/microsoft/azure/azure-maven-plugin-lib/0.1.4/azure-maven-plugin-lib-0.1.4.jar
  25. [ERROR] urls[13] = file:/C:/maven/repository/org/apache/maven/shared/maven-filtering/3.0.0/maven-filtering-3.0.0.jar
  26. [ERROR] urls[14] = file:/C:/maven/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
  27. [ERROR] urls[15] = file:/C:/maven/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
  28. [ERROR] urls[16] = file:/C:/maven/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
  29. [ERROR] urls[17] = file:/C:/maven/repository/com/microsoft/azure/azure/1.2.1/azure-1.2.1.jar
  30. [ERROR] urls[18] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-resources/1.2.1/azure-mgmt-resources-1.2.1.jar
  31. [ERROR] urls[19] = file:/C:/maven/repository/org/slf4j/slf4j-simple/1.7.5/slf4j-simple-1.7.5.jar
  32. [ERROR] urls[20] = file:/C:/maven/repository/io/reactivex/rxjava/1.2.4/rxjava-1.2.4.jar
  33. [ERROR] urls[21] = file:/C:/maven/repository/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar
  34. [ERROR] urls[22] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-storage/1.2.1/azure-mgmt-storage-1.2.1.jar
  35. [ERROR] urls[23] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-network/1.2.1/azure-mgmt-network-1.2.1.jar
  36. [ERROR] urls[24] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-compute/1.2.1/azure-mgmt-compute-1.2.1.jar
  37. [ERROR] urls[25] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-graph-rbac/1.2.1/azure-mgmt-graph-rbac-1.2.1.jar
  38. [ERROR] urls[26] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-keyvault/1.2.1/azure-mgmt-keyvault-1.2.1.jar
  39. [ERROR] urls[27] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-batch/1.2.1/azure-mgmt-batch-1.2.1.jar
  40. [ERROR] urls[28] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-trafficmanager/1.2.1/azure-mgmt-trafficmanager-1.2.1.jar
  41. [ERROR] urls[29] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-dns/1.2.1/azure-mgmt-dns-1.2.1.jar
  42. [ERROR] urls[30] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-redis/1.2.1/azure-mgmt-redis-1.2.1.jar
  43. [ERROR] urls[31] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-appservice/1.2.1/azure-mgmt-appservice-1.2.1.jar
  44. [ERROR] urls[32] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-cdn/1.2.1/azure-mgmt-cdn-1.2.1.jar
  45. [ERROR] urls[33] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-sql/1.2.1/azure-mgmt-sql-1.2.1.jar
  46. [ERROR] urls[34] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-containerregistry/1.2.1/azure-mgmt-containerregistry-1.2.1.jar
  47. [ERROR] urls[35] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-cosmosdb/1.2.1/azure-mgmt-cosmosdb-1.2.1.jar
  48. [ERROR] urls[36] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-search/1.2.1/azure-mgmt-search-1.2.1.jar
  49. [ERROR] urls[37] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-servicebus/1.2.1/azure-mgmt-servicebus-1.2.1.jar
  50. [ERROR] urls[38] = file:/C:/maven/repository/joda-time/joda-time/2.1/joda-time-2.1.jar
  51. [ERROR] urls[39] = file:/C:/maven/repository/com/microsoft/azure/azure-client-runtime/1.1.0/azure-client-runtime-1.1.0.jar
  52. [ERROR] urls[40] = file:/C:/maven/repository/com/microsoft/rest/client-runtime/1.1.0/client-runtime-1.1.0.jar
  53. [ERROR] urls[41] = file:/C:/maven/repository/com/squareup/retrofit2/retrofit/2.1.0/retrofit-2.1.0.jar
  54. [ERROR] urls[42] = file:/C:/maven/repository/com/squareup/okhttp3/okhttp/3.3.1/okhttp-3.3.1.jar
  55. [ERROR] urls[43] = file:/C:/maven/repository/com/squareup/okio/okio/1.8.0/okio-1.8.0.jar
  56. [ERROR] urls[44] = file:/C:/maven/repository/com/squareup/okhttp3/logging-interceptor/3.3.1/logging-interceptor-3.3.1.jar
  57. [ERROR] urls[45] = file:/C:/maven/repository/com/squareup/okhttp3/okhttp-urlconnection/3.3.1/okhttp-urlconnection-3.3.1.jar
  58. [ERROR] urls[46] = file:/C:/maven/repository/com/squareup/retrofit2/converter-jackson/2.1.0/converter-jackson-2.1.0.jar
  59. [ERROR] urls[47] = file:/C:/maven/repository/com/fasterxml/jackson/core/jackson-databind/2.7.2/jackson-databind-2.7.2.jar
  60. [ERROR] urls[48] = file:/C:/maven/repository/com/fasterxml/jackson/datatype/jackson-datatype-joda/2.7.2/jackson-datatype-joda-2.7.2.jar
  61. [ERROR] urls[49] = file:/C:/maven/repository/com/fasterxml/jackson/core/jackson-annotations/2.7.0/jackson-annotations-2.7.0.jar
  62. [ERROR] urls[50] = file:/C:/maven/repository/com/squareup/retrofit2/adapter-rxjava/2.1.0/adapter-rxjava-2.1.0.jar
  63. [ERROR] urls[51] = file:/C:/maven/repository/com/microsoft/azure/azure-client-authentication/1.1.0/azure-client-authentication-1.1.0.jar
  64. [ERROR] urls[52] = file:/C:/maven/repository/com/microsoft/azure/adal4j/1.1.2/adal4j-1.1.2.jar
  65. [ERROR] urls[53] = file:/C:/maven/repository/com/nimbusds/oauth2-oidc-sdk/4.5/oauth2-oidc-sdk-4.5.jar
  66. [ERROR] urls[54] = file:/C:/maven/repository/javax/mail/mail/1.4.7/mail-1.4.7.jar
  67. [ERROR] urls[55] = file:/C:/maven/repository/javax/activation/activation/1.1/activation-1.1.jar
  68. [ERROR] urls[56] = file:/C:/maven/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar
  69. [ERROR] urls[57] = file:/C:/maven/repository/net/minidev/json-smart/1.1.1/json-smart-1.1.1.jar
  70. [ERROR] urls[58] = file:/C:/maven/repository/com/nimbusds/lang-tag/1.4/lang-tag-1.4.jar
  71. [ERROR] urls[59] = file:/C:/maven/repository/com/nimbusds/nimbus-jose-jwt/3.1.2/nimbus-jose-jwt-3.1.2.jar
  72. [ERROR] urls[60] = file:/C:/maven/repository/org/bouncycastle/bcprov-jdk15on/1.51/bcprov-jdk15on-1.51.jar
  73. [ERROR] urls[61] = file:/C:/maven/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
  74. [ERROR] urls[62] = file:/C:/maven/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar
  75. [ERROR] urls[63] = file:/C:/maven/repository/com/microsoft/azure/azure-annotations/1.2.0/azure-annotations-1.2.0.jar
  76. [ERROR] urls[64] = file:/C:/maven/repository/com/microsoft/azure/applicationinsights-core/1.0.9/applicationinsights-core-1.0.9.jar
  77. [ERROR] urls[65] = file:/C:/maven/repository/eu/infomas/annotation-detector/3.0.4/annotation-detector-3.0.4.jar
  78. [ERROR] urls[66] = file:/C:/maven/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
  79. [ERROR] urls[67] = file:/C:/maven/repository/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar
  80. [ERROR] urls[68] = file:/C:/maven/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
  81. [ERROR] urls[69] = file:/C:/maven/repository/commons-net/commons-net/3.6/commons-net-3.6.jar
  82. [ERROR] urls[70] = file:/C:/maven/repository/com/microsoft/azure/azure-functions-java-core/1.0.0-beta-1/azure-functions-java-core-1.0.0-beta-1.jar
  83. [ERROR] urls[71] = file:/C:/maven/repository/org/reflections/reflections/0.9.11/reflections-0.9.11.jar
  84. [ERROR] urls[72] = file:/C:/maven/repository/com/google/guava/guava/20.0/guava-20.0.jar
  85. [ERROR] urls[73] = file:/C:/maven/repository/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar
  86. [ERROR] urls[74] = file:/C:/maven/repository/com/microsoft/azure/azure-storage/5.4.0/azure-storage-5.4.0.jar
  87. [ERROR] urls[75] = file:/C:/maven/repository/com/fasterxml/jackson/core/jackson-core/2.6.0/jackson-core-2.6.0.jar
  88. [ERROR] urls[76] = file:/C:/maven/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
  89. [ERROR] urls[77] = file:/C:/maven/repository/com/microsoft/azure/azure-keyvault-core/0.8.0/azure-keyvault-core-0.8.0.jar
  90. [ERROR] urls[78] = file:/C:/maven/repository/org/zeroturnaround/zt-zip/1.12/zt-zip-1.12.jar
  91. [ERROR] urls[79] = file:/C:/maven/repository/junit/junit/4.12/junit-4.12.jar
  92. [ERROR] urls[80] = file:/C:/maven/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
  93. [ERROR] Number of foreign imports: 1
  94. [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
  95. [ERROR]
  96. [ERROR] -----------------------------------------------------
  97. [ERROR] : javax.xml.bind.JAXBException
  98. [ERROR] -> [Help 1]
  99. [ERROR]
  100. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  101. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  102. [ERROR]
  103. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  104. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
  105. The terminal process terminated with exit code: 1
  106. Terminal will be reused by tasks, press any key to close it.

答案1

得分: 1

问题出在不兼容的Java版本上。目前Azure Functions仅支持JDK8,但我使用了JDK11。切换到正确的Java版本后,问题得以解决。

英文:

Turned out that the problem is with the incompatible java version. Currently azure functions support only JDK8 but I used JDK11. After switching to the right java version, the problem is solved.

答案2

得分: 1

我遇到了相同的问题,使用 Azure Functions 创建的默认 pom.xml 在使用 Java 11 时会出现错误。

我发现自 2021 年 10 月 26 日起,Azure 已经添加了对 Java 11 的支持。

https://azure.microsoft.com/en-in/updates/java-11-support-for-azure-functions-is-now-generally-available/

但是默认的 pom 仍然带有 1.8 的支持配置。

我使用了 https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#java-versions 作为参考,并按照下面的方式更新了 pom.xml,以便在 Java 11 中编译和运行。

  1. <properties>
  2. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  3. <java.version>11</java.version>
  4. <azure.functions.maven.plugin.version>1.6.0</azure.functions.maven.plugin.version>
  5. <azure.functions.java.library.version>1.3.1</azure.functions.java.library.version>
  6. <maven.compiler.source>11</maven.compiler.source>
  7. <maven.compiler.target>11</maven.compiler.target>
  8. <functionAppName>dummy-sample-20211118</functionAppName>
  9. </properties>
  10. <dependencies>
  11. <dependency>
  12. <groupId>com.microsoft.azure</groupId>
  13. <artifactId>azure-functions-java-core</artifactId>
  14. <version>1.0.0-beta-3</version>
  15. </dependency>
  16. <!-- Test -->
  17. <dependency>
  18. <groupId>junit</groupId>
  19. <artifactId>junit</artifactId>
  20. <version>4.12</version>
  21. <scope>test</scope>
  22. </dependency>
  23. </dependencies>
  24. <build>
  25. <pluginManagement>
  26. <plugins>
  27. <plugin>
  28. <artifactId>maven-resources-plugin</artifactId>
  29. <version>3.2.0</version>
  30. </plugin>
  31. <plugin>
  32. <groupId>com.microsoft.azure</groupId>
  33. <artifactId>azure-functions-maven-plugin</artifactId>
  34. <version>${azure.functions.maven.plugin.version}</version>
  35. </plugin>
  36. </plugins>
  37. </pluginManagement>
  38. <plugins>
  39. <plugin>
  40. <groupId>com.microsoft.azure</groupId>
  41. <artifactId>azure-functions-maven-plugin</artifactId>
  42. <configuration>
  43. <resourceGroup>java-functions-group</resourceGroup>
  44. <appName>${functionAppName}</appName>
  45. <region>westus2</region>
  46. <appSettings>
  47. <property>
  48. <name>FUNCTIONS_EXTENSION_VERSION</name>
  49. <value>beta</value>
  50. </property>
  51. </appSettings>
  52. </configuration>
  53. <executions>
  54. <execution>
  55. <id>package-functions</id>
  56. <goals>
  57. <goal>package</goal>
  58. </goals>
  59. </execution>
  60. </executions>
  61. </plugin>
  62. <plugin>
  63. <artifactId>maven-resources-plugin</artifactId>
  64. <executions>
  65. <execution>
  66. <id>copy-resources</id>
  67. <phase>package</phase>
  68. <goals>
  69. <goal>copy-resources</goal>
  70. </goals>
  71. <configuration>
  72. <overwrite>true</overwrite>
  73. <outputDirectory>${project.build.directory}/azure-functions/${functionAppName}
  74. </outputDirectory>
  75. <resources>
  76. <resource>
  77. <directory>${project.basedir}</directory>
  78. <includes>
  79. <include>host.json</include>
  80. <include>local.settings.json</include>
  81. </includes>
  82. </resource>
  83. </resources>
  84. </configuration>
  85. </execution>
  86. </executions>
  87. </plugin>
  88. </plugins>
  89. </build>

</project>

英文:

I encountered the same issue, the default pom.xml created with Azure Functions gives this error when using Java 11.

I found that Azure has added support for Java 11 since 26th Oct 2021.

https://azure.microsoft.com/en-in/updates/java-11-support-for-azure-functions-is-now-generally-available/

But the default pom still comes with 1.8 support configurations.

I used this https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#java-versions as a reference and updated the pom.xml as below to make it compile and run in Java 11.

  1. &lt;properties&gt;
  2. &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  3. &lt;java.version&gt;11&lt;/java.version&gt;
  4. &lt;azure.functions.maven.plugin.version&gt;1.6.0&lt;/azure.functions.maven.plugin.version&gt;
  5. &lt;azure.functions.java.library.version&gt;1.3.1&lt;/azure.functions.java.library.version&gt;
  6. &lt;maven.compiler.source&gt;11&lt;/maven.compiler.source&gt;
  7. &lt;maven.compiler.target&gt;11&lt;/maven.compiler.target&gt;
  8. &lt;functionAppName&gt;dummy-sample-20211118&lt;/functionAppName&gt;
  9. &lt;/properties&gt;
  10. &lt;dependencies&gt;
  11. &lt;dependency&gt;
  12. &lt;groupId&gt;com.microsoft.azure&lt;/groupId&gt;
  13. &lt;artifactId&gt;azure-functions-java-core&lt;/artifactId&gt;
  14. &lt;version&gt;1.0.0-beta-3&lt;/version&gt;
  15. &lt;/dependency&gt;
  16. &lt;!-- Test --&gt;
  17. &lt;dependency&gt;
  18. &lt;groupId&gt;junit&lt;/groupId&gt;
  19. &lt;artifactId&gt;junit&lt;/artifactId&gt;
  20. &lt;version&gt;4.12&lt;/version&gt;
  21. &lt;scope&gt;test&lt;/scope&gt;
  22. &lt;/dependency&gt;
  23. &lt;/dependencies&gt;
  24. &lt;build&gt;
  25. &lt;pluginManagement&gt;
  26. &lt;plugins&gt;
  27. &lt;plugin&gt;
  28. &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
  29. &lt;version&gt;3.2.0&lt;/version&gt;
  30. &lt;/plugin&gt;
  31. &lt;plugin&gt;
  32. &lt;groupId&gt;com.microsoft.azure&lt;/groupId&gt;
  33. &lt;artifactId&gt;azure-functions-maven-plugin&lt;/artifactId&gt;
  34. &lt;version&gt;${azure.functions.maven.plugin.version}&lt;/version&gt;
  35. &lt;/plugin&gt;
  36. &lt;/plugins&gt;
  37. &lt;/pluginManagement&gt;
  38. &lt;plugins&gt;
  39. &lt;plugin&gt;
  40. &lt;groupId&gt;com.microsoft.azure&lt;/groupId&gt;
  41. &lt;artifactId&gt;azure-functions-maven-plugin&lt;/artifactId&gt;
  42. &lt;configuration&gt;
  43. &lt;resourceGroup&gt;java-functions-group&lt;/resourceGroup&gt;
  44. &lt;appName&gt;${functionAppName}&lt;/appName&gt;
  45. &lt;region&gt;westus2&lt;/region&gt;
  46. &lt;appSettings&gt;
  47. &lt;property&gt;
  48. &lt;name&gt;FUNCTIONS_EXTENSION_VERSION&lt;/name&gt;
  49. &lt;value&gt;beta&lt;/value&gt;
  50. &lt;/property&gt;
  51. &lt;/appSettings&gt;
  52. &lt;/configuration&gt;
  53. &lt;executions&gt;
  54. &lt;execution&gt;
  55. &lt;id&gt;package-functions&lt;/id&gt;
  56. &lt;goals&gt;
  57. &lt;goal&gt;package&lt;/goal&gt;
  58. &lt;/goals&gt;
  59. &lt;/execution&gt;
  60. &lt;/executions&gt;
  61. &lt;/plugin&gt;
  62. &lt;plugin&gt;
  63. &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
  64. &lt;executions&gt;
  65. &lt;execution&gt;
  66. &lt;id&gt;copy-resources&lt;/id&gt;
  67. &lt;phase&gt;package&lt;/phase&gt;
  68. &lt;goals&gt;
  69. &lt;goal&gt;copy-resources&lt;/goal&gt;
  70. &lt;/goals&gt;
  71. &lt;configuration&gt;
  72. &lt;overwrite&gt;true&lt;/overwrite&gt;
  73. &lt;outputDirectory&gt;${project.build.directory}/azure-functions/${functionAppName}
  74. &lt;/outputDirectory&gt;
  75. &lt;resources&gt;
  76. &lt;resource&gt;
  77. &lt;directory&gt;${project.basedir}&lt;/directory&gt;
  78. &lt;includes&gt;
  79. &lt;include&gt;host.json&lt;/include&gt;
  80. &lt;include&gt;local.settings.json&lt;/include&gt;
  81. &lt;/includes&gt;
  82. &lt;/resource&gt;
  83. &lt;/resources&gt;
  84. &lt;/configuration&gt;
  85. &lt;/execution&gt;
  86. &lt;/executions&gt;
  87. &lt;/plugin&gt;
  88. &lt;/plugins&gt;
  89. &lt;/build&gt;

</project>

huangapple
  • 本文由 发表于 2020年4月11日 05:38:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/61149061.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定