Is something wrong with my pom.xml which could be causing GitHub actions to throw an error when trying to Restore Project Dependencies Using Mvn? I have a feeling there is some sort of compatibility issues with the versions being used but cannot tell.
Note: My application works perfectly fine locally. It is a basic application which leverages Java Azure Functions and CosmosDB to write and read data from a DB.
Error:
Error: Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.28.0:
package (package-functions) on project azure-functions-java: Local Azure Functions Core Tools
does not exist or is too old to support function extension installation, skip package phase.
To install or update it, see: https://aka.ms/azfunc-install -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
Error:
Error: For more information about the errors and possible solutions, please read the following articles:
Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error: Process completed with exit code 1.
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>azure-functions-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>azure-functions-java</name>
<description>Demo project for Azure Functions</description>
<properties>
<java.version>21</java.version>
<functionResourceGroup>xxx-rg</functionResourceGroup>
<functionAppServicePlanName>yyy</functionAppServicePlanName>
<functionAppName>zzz</functionAppName>
<functionAppRegion>westus</functionAppRegion>
<functionPricingTier>Y1</functionPricingTier>
<start-class>org.example.Main</start-class>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>1.28.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<configuration>
<resourceGroup>${functionResourceGroup}</resourceGroup>
<appName>${functionAppName}</appName>
<region>${functionAppRegion}</region>
<appServicePlanName>${functionAppServicePlanName}</appServicePlanName>
<pricingTier>${functionPricingTier}</pricingTier>
<hostJson>${project.basedir}/host.json</hostJson>
<localSettingsJson>${project.basedir}/local.settings.json</localSettingsJson>
<runtime>
<os>linux</os>
<javaVersion>21</javaVersion>
</runtime>
<appSettings>
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~4</value>
</property>
</appSettings>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Follow below steps to deploy the Java CosmosDB triggered Azure function to Azure Function app using GitHub Actions.
pom.xml:
Local response:
Steps to deploy the function using GitHub actions:
Function app=> deployment=> Deployment Center
, selectGitHub
asSource
..github/workflows
to deploy the function to Azure.My Workflow:
Deployment Status:
Portal: