GoogleCloudPlatform / functions-framework-java

FaaS (Function as a service) framework for writing portable Java functions
Apache License 2.0
133 stars 63 forks source link

BuildPack is using obsolete version of maven, causing build failures #210

Closed nbrandaleone closed 1 year ago

nbrandaleone commented 1 year ago

I am trying to run the HelloWorld function example. I am getting an error from Cloud Build that the Cloud Function will not build due to an outdated version of maven, which seems to be referenced from a build pack. This build pack is being added into the artifact dynamically by Cloud Functions.

"Step #1 - "build": Failure: (ID: 86a1af80) Maven version 3.6.3 does not exist at https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz (status 404)."

Local testing works fine. Using the following minimal pom.xml

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>functions</groupId>
  <artifactId>functions-HelloWorld</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <properties>
    <maven.compiler.target>17</maven.compiler.target>
    <maven.compiler.source>17</maven.compiler.source>
  </properties>

  <dependencies>
    <!-- Required for Function primitives -->
    <dependency>
      <groupId>com.google.cloud.functions</groupId>
      <artifactId>functions-framework-api</artifactId>
      <version>1.1.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <!--
          Google Cloud Functions Framework Maven plugin

          This plugin allows you to run Cloud Functions Java code
          locally. Use the following terminal command to run a
          given function locally:

          mvn function:run -Drun.functionTarget=your.package.yourFunction
        -->
        <groupId>com.google.cloud.functions</groupId>
        <artifactId>function-maven-plugin</artifactId>
        <version>0.10.1</version>
        <configuration>
          <functionTarget>functions.HelloWorld</functionTarget>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
josephlewis42 commented 1 year ago

This was an issue with the upstream bulidpack: https://github.com/GoogleCloudPlatform/buildpacks/issues/316 which should be resolved now.

The buildpack image had a (very) outdated version of Maven that was removed from the repos.