2

I have a very simple Hello World Java Project in CodeCommmit, with following structure

This is a sample template for sam-app - Below is a brief explanation of what we have generated for you:

├── README.md                                   <-- This instructions file 
├── HelloWorldFunction                          <-- Source for HelloWorldFunction Lambda Function 
│   ├── pom.xml                                 <-- Java dependencies 
│   └── src 
│       ├── main 
│       │   └── java 
│       │       └── helloworld 
│       │           ├── App.java                <-- Lambda function code 
│       │           └── GatewayResponse.java    <-- POJO for API Gateway Responses object  
│       └── test                                <-- Unit tests 
│           └── java 
│               └── helloworld 
│                   └── AppTest.java 
└── template.yaml 

I am using CodeBuild and My buildspec.yml looks like

version: 0.1 

phases: 
  install: 
    commands: 
      - echo Nothing to do in the install phase... 
  pre_build: 
    commands: 
      - echo Nothing to do in the pre_build phase... 
  build: 
    commands: 
      - echo Build started on this `date` 
      - pwd 
      - ls  
      - cd ./HelloWorldFunction 
      - pwd 
      - mvn install 
  post_build: 
    commands: 
      - echo Build completed on `date` 
artifacts: 
  files: 
    - target/JavaWeb.war 

But the logs from CodeBuild run looks like aws cannot "change directory" to correct sub folder. not sure if i am missing something ?? enter image description here

Lav
  • 1,283
  • 5
  • 21
  • 48

1 Answers1

5

Please change the buildspec to version 0.2 (from 0.1), which should fix this issue.

Subin Mathew
  • 2,335
  • 1
  • 16
  • 24