Reputation: 109
I have created repository and pushed the code by using aws code commit. Whenever i made changes and push it to repository,it has updated. But when i used to do build by using aws code build, it is failing bec not able to find the buildspec.yml and pom.xml.
Please find the attachment as My yaml file(buildspec.yml) and my pom.xml file in root..
I have tried with 2 scenarios in awscodebuild.
buildspec.yml in my code, but it is failed in downloaded-source and indicating the error below CODEBUILD_SRC_DIR=/codebuild/output/src408069893/src/awsgitrepo CODEBUILD_SRC_DIR=/codebuild/output/src408069893/src/awsgitrepo/buildspec.yml - No such file or directory.
When i tried with insert build commands in awscodebuild, it is failed and stating that
/codebuild/output/src408069893/src/awsgitrepo/ - The goal you specified requires a project, but there is no pom in this directory.
Both error indicating the samepath and missing files.
So could you please let me know how to avoid this failure. Is there a way to set the path for code build to pick up the source files.Want to know about the CODEBUILD_SRC_DIR which one how to set it and the need of CODEBUILD_SRC_DIR.
Upvotes: 1
Views: 7640
Reputation: 396
I had exactly the same problem with aws pipeline test project and it turned out that the structure of my repository on github was bad.
You need to have (root directory name)
-- my-web-app
|-- src
| `-- main
| |-- resources
| `-- webapp
| |-- WEB-INF
| | `-- web.xml
| `-- index.jsp
|-- buildspec.yml
`-- pom.xml
as it say here:
To sum up, in order to aws code build find your pom and buildspec you need to have correct git repo structure as: repository_name > [src, pom.xml, buildspec.yml...] and NOT: repository name > root_repo_dir > [src, pom.xml, buildspec.yml...]
Hope it helped!
Upvotes: 3
Reputation: 346
From the error log, it seems the pom.xml and the buildspec.yml are not in the root folder. Try inserting this command find . -name pom.xml
in scenario 2 to locate the pom.xml.
Upvotes: 1