Reputation: 5187
I recently started to get an error with maven when running the command sam build
.
I decided to create the hello world application (https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html) to see if I would also get the same error and I get it.
Here is the output after running sam build
:
Building codeuri: [service] runtime: java11 metadata: {} functions: ['service']
C:\apache-maven-3.6.3\bin\mvn.CMD failed to return a version string using the '-v' option. The workflow is unable to check that the version of the JVM used is compatible with AWS Lambda.
Here is the output of C:\apache-maven-3.6.3\bin\mvn.CMD -v
:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\apache-maven-3.6.3\bin\..
Java version: 1.8.0_261, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_261\jre
Default locale: en_CA, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
The system cannot find the path specified.
Upvotes: 1
Views: 1312
Reputation: 41
There is text "The system cannot find the path specified." as an output of "mvn.CMD -v" which is not ok.
The way it worked for me is added "set JAVA_HOME=<JAVA_PATH8_JDK>"
eg. set JAVA_HOME=C:\md\sw\java\in
in mvn.cmd
If you are working on visual code you have to restart visual studio code after maven setup .
Upvotes: 2