Lav
Lav

Reputation: 1313

AWS CodeBuild unable to use CD command

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

Upvotes: 2

Views: 1700

Answers (1)

Subin Mathew
Subin Mathew

Reputation: 2545

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

Upvotes: 6

Related Questions