aws-sam-cli
aws-sam-cli copied to clipboard
Unable to build due to parent relative path
Description
I faced an build issue when I build the serverless application on my local machine. The pom error show
[ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.
However, this is not a maven issue, because I am able to build my project successfully manually with the maven command.
Steps to reproduce
- Clone repository: [email protected]:francis-pang/expense-tally.git
- Check out branch feature/aws-sam
- Navigate to ./aws-lambda/get-expenses
- Build application via command
sam build --use-container --template-file template.yaml
Observed result
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics 'build' command is called Starting Build inside a container No Parameters detected in the template 2 resources found in the template Found Serverless function with name='GetDiscrepantExpensesFunction' and CodeUri='.' No Parameters detected in the template Building function 'GetDiscrepantExpensesFunction' Looking for a supported build workflow in following directories: ['/d/code/expense-tally/aws-lambda/get-expenses', '/d/code/expense-tally/> aws-lambda/get-expenses']
Fetching amazon/aws-sam-cli-build-image-java11 Docker container image...... Mounting /d/code/expense-tally/aws-lambda/get-expenses as /tmp/samcli/source:ro,delegated inside runtime container Using the request object from command line argument Loading workflow module 'aws_lambda_builders.workflows' Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)' Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)' Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)> ' Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)' Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)' Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)' Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)' Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', > application_framework=None)' Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)' Found workflow 'JavaMavenWorkflow' to support capabilities 'Capability(language='java', dependency_manager='maven', application_framework=None)' Running workflow 'JavaMavenWorkflow' Running JavaMavenWorkflow:CopySource JavaMavenWorkflow:CopySource succeeded Running JavaMavenWorkflow:MavenBuild Maven logs: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException JavaMavenWorkflow:MavenBuild failed Traceback (most recent call last): File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflows/java_maven/actions.py", line 36, in execute self.subprocess_maven.build(self.scratch_dir) File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflows/java_maven/maven.py", line 34, in build raise MavenExecutionError(message=stdout.decode("utf8").strip()) aws_lambda_builders.workflows.java_maven.maven.MavenExecutionError: Maven Failed: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelExceptionDuring handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflow.py", line 269, in run action.execute() File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflows/java_maven/actions.py", line 38, in execute raise ActionFailedError(str(ex)) aws_lambda_builders.actions.ActionFailedError: Maven Failed: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException Builder workflow failed Traceback (most recent call last): File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflows/java_maven/actions.py", line 36, in execute self.subprocess_maven.build(self.scratch_dir) File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflows/java_maven/maven.py", line 34, in build raise MavenExecutionError(message=stdout.decode("utf8").strip()) aws_lambda_builders.workflows.java_maven.maven.MavenExecutionError: Maven Failed: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelExceptionDuring handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflow.py", line 269, in run action.execute() File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflows/java_maven/actions.py", line 38, in execute raise ActionFailedError(str(ex)) aws_lambda_builders.actions.ActionFailedError: Maven Failed: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelExceptionDuring handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/main.py", line 126, in main mode=params.get("mode", None), File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/builder.py", line 125, in build return workflow.run() File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflow.py", line 76, in wrapper func(self, *args, **kwargs) File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflow.py", line 276, in run raise WorkflowFailedError(workflow_name=self.NAME, action_name=action.NAME, reason=str(ex)) aws_lambda_builders.exceptions.WorkflowFailedError: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException Build inside container returned response {"jsonrpc": "2.0", "id": 1, "error": {"code": 400, "message": "JavaMavenWorkflow:MavenBuild - Maven > Failed: [INFO] Scanning for projects...\n[ERROR] [ERROR] Some problems were encountered while processing the POMs:\n[FATAL] Non-resolvable > parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.expense:aws-lambda:pom:49-SNAPSHOT and 'parent.> relativePath' points at wrong local POM @ line 5, column 13\n @ \n[ERROR] The build could not read 1 project -> [Help 1]\n[ERROR] \n[ERROR] > The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error\n[ERROR] Non-resolvable parent POM > for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.expense:aws-lambda:pom:49-SNAPSHOT and 'parent.> relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]\n[ERROR] \n[ERROR] To see the full stack trace of the errors, re-run > Maven with the -e switch.\n[ERROR] Re-run Maven using the -X switch to enable full debug logging.\n[ERROR] \n[ERROR] For more information about > the errors and possible solutions, please read the following articles:\n[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/> ProjectBuildingException\n[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException"}}Build Failed Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam > build', 'duration': 6984, 'exitReason': 'BuildInsideContainerError', 'exitCode': 1, 'requestId': '775eb3b0-a26a-41a4-8579-5401d79ea5a2', > 'installationId': '64dc910d-76cc-4269-b045-fbd8f21825bb', 'sessionId': 'c1531b71-4de3-4e4d-85ee-74c61a35f8d9', 'executionEnvironment': 'CLI', > 'pyversion': '3.8.5', 'samcliVersion': '1.4.0'}}]} HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1) Error: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.> expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Expected result
It is expected that the build will be successful. An execution of the successful run via maven command is uploaded to pastebin:https://pastebin.pl/view/0408a9f8
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
OS Name Microsoft Windows 10 Pro Version 10.0.19041 Build 19041 Execute this on WSL: WSL build: 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
WSL Distribution information Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal
Java version: 11 Maven version: 3.6
sam --version: 1.4.0
Hi @francis-pang ,
I tried to re-produce the issue you mentioned, but I ended up having other problems related to maven compiler plugin. After fixing those, the build process for maven completed successfully, but SAM build fails because there were no target/classes directory in the end.
And looking at the template file, CodeUri is pointing to 2 folders up (../../) for the code base of the lambda function. If you have shared dependency I would suggest to publish those packages as another dependency for your lambda function, or use layers.
Please let us know if you have further issues.
@mndeveci , I tried to build based on the root folder, in which the template looks as below (partially):
Resources:
GetDiscrepantExpensesFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Description: 'Retrieve all the mismatching transactions'
CodeUri: .
However it fails:
Running workflow 'JavaMavenWorkflow' Running JavaMavenWorkflow:CopySource JavaMavenWorkflow:CopySource succeeded Running JavaMavenWorkflow:MavenBuild Maven logs: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project tally.expense:aws-lambda-get-expenses:49-SNAPSHOT (/tmp/tmpgjbfjznj/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for tally.expense:aws-lambda-get-expenses:49-SNAPSHOT: Could not find artifact tally.expense:aws-lambda:pom:49-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]
I found out that the SAM build command copy all the content which the template.yaml is located into a directory inside /tmp/. However it does not copy the root directory, where the parent pom resides. Due to this lack of dependency, the build fails.
Is it a technical restriction that there cannot be parent pom dependency in SAM application pom file?
@francis-pang ,
I would suggest to move all source files of your lambda function under another folder. So your root folder will look like this;
.
├── YourFunctionCode
│ ├── pom.xml
│ └── src
│ ├── main
│ │ └── java
│ │ └── ...
│ └── test
│ └── java
│ └── ...
└── template.yaml
And if you have dependencies of other projects, I would rather put them into a repository so that build can pull them, or create Lambda Layer(s) to share common code between different functions.
Closing. Feel free to reopen if there is further issue.
from my POV this poses a major restriction on developing SAM with java, we cannot use a parent pom which holds common definitions for plugins and build life cycle not to mention be able to have shared dependencies (because after all they would have to be in a sibling folder, and we can't use layers because sam doesn't build those autoamtically (it would if we could have used reactor builds, that would build that dependency first
SAM CLI is synonym with head banging on maven multi-modules project...
...which are the bread and butter of developers who cleanly architect their code into multiple modules, and don't want to waste time mvn installing or (worse) releasing artifacts just to be able to deploy a serverless function during local development.
-
the
sam buildcommandmvn installs all modules to my local .m2 repostory which I go to great pains to kee free of manuallymvn installed dependencies. -
the
--debugflag does not output what is actually going on- copying an entire tree to
/tmp, wait, what? debug output should includecopying /blah/** to /tmp/blah...so I can troubleshoot more easily what's going on, and then bug you about the next invalid assumption in your maven support. - to make matters worse, the /tmp directory where you copy things is deleted before I ever get the chance to look into it to figure out what is going on.
- the JavaMavenWorkflow steps do not actually show what exact maven command was run, everything is a black box. 2021-02-11 14:54:16,250 | Running workflow 'JavaMavenWorkflow' 2021-02-11 14:54:16,251 | Running JavaMavenWorkflow:CopySource <<<<< What command? 2021-02-11 14:54:16,313 | JavaMavenWorkflow:CopySource succeeded 2021-02-11 14:54:16,313 | Running JavaMavenWorkflow:MavenBuild <<<<< What command? 2021-02-11 14:54:38,600 | JavaMavenWorkflow:MavenBuild succeeded 2021-02-11 14:54:38,600 | Running JavaMavenWorkflow:MavenCopyDependency <<<<< What command? 2021-02-11 14:54:40,834 | JavaMavenWorkflow:MavenCopyDependency succeeded 2021-02-11 14:54:40,834 | Running JavaMavenWorkflow:MavenCopyArtifacts <<<<< What command? 2021-02-11 14:54:40,834 | JavaMavenWorkflow:MavenCopyArtifacts failed
- copying an entire tree to
-
the poster is advised to change his project structure from a perfectly valid maven project structure, and then the issue is closed. How does that fix the problem? In order to show how the structure you impose on project structure is totally arbitrary, I expanded the generated java11 maven hello-world from sam cli with a second identical helloworld function, and added a 3rd top-level shared code module.
$ java -version
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment Corretto-11.0.7.10.1 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.7.10.1 (build 11.0.7+10-LTS, mixed mode)
$ mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/lestephane/.sdkman/candidates/maven/current
Java version: 11.0.7, vendor: Amazon.com Inc., runtime: /home/lestephane/.jdks/corretto-11.0.7
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-133-generic", arch: "amd64", family: "unix"
$ sam --version
SAM CLI, version 1.18.0
$ rm -rv ~/.m2/repository/helloworld/
$ git clone https://github.com/lestephane/sam-java11-maven-multimodule-app.git && sam-java11-maven-multimodule-app
$ mvn compile
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for HelloWorldParent 1.0:
[INFO]
[INFO] HelloWorldShared ................................... SUCCESS [ 0.415 s]
[INFO] HelloWorld ......................................... SUCCESS [ 0.011 s]
[INFO] HelloWorld2 ........................................ SUCCESS [ 0.008 s]
[INFO] HelloWorldParent ................................... SUCCESS [ 0.001 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
$ sam build
Building codeuri: HelloWorldFunction runtime: java11 metadata: {} functions: ['HelloWorldFunction']
Running JavaMavenWorkflow:CopySource
Running JavaMavenWorkflow:MavenBuild
Build Failed
Error: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< helloworld:HelloWorld >------------------------
[INFO] Building HelloWorld 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for helloworld:HelloWorldShared:jar:1.0 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/helloworld/HelloWorldShared/1.0/HelloWorldShared-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.809 s
[INFO] Finished at: 2021-02-11T16:04:33+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project HelloWorld: Could not resolve dependencies for project helloworld:HelloWorld:jar:1.0: Could not find artifact helloworld:HelloWorldShared:jar:1.0 in central (https://repo.maven.apache.org/maven2) -> [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
The multi-module maven support is poor in SAM CLI. Please take it seriously.
problem still exists.
Error: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for cn.hashdata:key-center-lambda-function:1.0-SNAPSHOT: Could not find artifact cn.hashdata:cloud:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project cn.hashdata:key-center-lambda-function:1.0-SNAPSHOT (/private/var/folders/l9/lc7d0t_97r7b38pmbl_3h8nc0000gn/T/tmpj4x4vykc/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for cn.hashdata:key-center-lambda-function:1.0-SNAPSHOT: Could not find artifact cn.hashdata:cloud:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
SAM Build has failed: Command did not exit successfully, exit code: 1
KeyCenterFunction has failed: Command did not exit successfully, exit code: 1
@mndeveci could you please help with this? Multi-module maven support is poor.
@pengfeiwang-cn can you give an example template that we can use to re-produce the issue that you are facing?
First message in this thread has this example ([email protected]:francis-pang/expense-tally.git), is yours same as that one?
Following
Found a workaround but this is still painfull... 👍 for this feature to be implemented.
the workaround:
from-parent-pom$ mvn install
it will copy the parent-pom in ~/.m2/...
then sam build will work
This is still an issue and is discouraging my company from using SAM.
geofence/
├── geofence-lambda/
│ ├── src/
│ ├── Dockerfile
│ ├── lombok.config
│ └── pom.xml
├── geofence-service/
│ ├── src/
│ ├── Dockerfile
│ ├── lombok.config
│ └── pom.xml
└── pom.xml
If Maven can build the project, why can't SAM?
docker ps
/usr/local/bin/sam build Function --template /Users/dobrim1/dev/geofence/geofence-lambda/.aws-sam/temp-template.yaml --build-dir /Users/dobrim1/dev/geofence/geofence-lambda/.aws-sam/build --use-container
Starting Build inside a container
Building codeuri: /Users/dobrim1/dev/geofence/geofence-lambda runtime: java17 architecture: x86_64 functions: Function
Fetching public.ecr.aws/sam/build-java17:latest-x86_64 Docker container image......
Mounting /Users/dobrim1/dev/geofence/geofence-lambda as /tmp/samcli/source:ro,delegated, inside runtime container
Build Failed
Running JavaMavenWorkflow:CopySource
Running JavaMavenWorkflow:MavenBuild
Error: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for company:geofence-lambda:1.0.0-SNAPSHOT: Could not find artifact company:geofence-history:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 11
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project company:geofence-lambda:1.0.0-SNAPSHOT (/tmp/samcli/scratch/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for company:geofence-lambda:1.0.0-SNAPSHOT: Could not find artifact company:geofence-history:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 11 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
SAM Build has failed: Command did not exit successfully, exit code: 1
93 has failed: Command did not exit successfully, exit code: 1