serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
272 stars 127 forks source link

gcloud function: Could not find local artifact: How to solve? #253

Closed anborg closed 3 years ago

anborg commented 3 years ago

My cloud function maven-jar-project, depends on other internal project (jar), so I have added that as a dependency to the pom.xml.

I don't want to copy paste those sourcecode directly in gcloud maven project.

Expected:

I expected that the dependent jars will be automatically included in the cloud function deployment, however I get an error "could not find artifact". Local compilation & running does not have any issue.

[INFO] Installing <removed>-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.659 s
[INFO] Finished at: 2021-04-10T16:31:39-04:00
[INFO] ------------------------------------------------------------------------

>gcloud functions deploy response-adapter --entry-point fun.pubsub.<removed> --runtime java11  --memory 512MB --trigger-topic <removed>
 --env-vars-file env.yml

Deploying function (may take a while - up to 2 minutes)...-
For Cloud Build Stackdriver Logs, visit: 

Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: ...maven-plugin-2.2.0.jar
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/com/google/cloud/tools/appengine-plugins-core/0.8.1/appengine-plugins-core-0.8.1.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/inject/guice/4.2.1/guice-4.2.1-no_aop.jar (521 kB at 375 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar (502 kB at 357 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/tools/appengine-maven-plugin/2.2.0/appengine-maven-plugin-2.2.0.jar (76 kB at 53 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.19/commons-compress-1.19.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/tools/appengine-plugins-core/0.8.1/appengine-plugins-core-0.8.1.jar (236 kB at 164 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/commons-io/commons-io/2.5/commons-io-2.5.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar (85 kB at 59 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar (299 kB at 205 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.19/commons-compress-1.19.jar (615 kB at 416 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/commons-io/commons-io/2.5/commons-io-2.5.jar (209 kB at 141 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/functions/invoker/java-function-invoker/1.0.2/java-function-invoker-1.0.2.jar (4.2 MB at 2.6 MB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  17.127 s
[INFO] Finished at: 2021-04-10T20:35:09Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gcf-removed-adapter: Could not resolve dependencies for project gcf-demo:gcf-removed-adapter:jar:0.0.1-SNAPSHOT: Could not find artifact myadaptor:removed-mapper:jar:1.0-
SNAPSHOT -> [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/DependencyResolutionException; Error ID: efa79f31