I feel as though I've trawled the entire internet and SO previous questions and tested every combination and permutation to try and get this working, but nothing at all I try works. I cannot seem to find a reliable guide to follow for this and/or decent logging.
A local Maven build of the .war file and the manual upload of the .war file to Elastic Beanstalk works absolutely fine.
But I really don't want to be having to do this.
Many of the options I've tried from the guides, end up with the CodeBuild process working and apparently saving the output to S3 - but when I click the link, to the S3 object, it's not there.
Here's the latest buildspec.yml file for what it's worth.
version: 0.2
phases:
install:
runtime-versions:
java: corretto11
build:
commands:
- mvn clean
- mvn install
post_build:
commands:
- mv target/MyApp-1.0.war ROOT.war
artifacts:
files:
- ROOT.war
I'm not sure the mv command is needed as when I check the CodeBuild logs, I can see this;
[INFO] Building war: /codebuild/output/src1021125740/src/target/MyApp-1.0.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Any ideas on next steps to try? If I can at least get the war file generating and accessible either on S3 or CodeArtifact or passing it directly to the next step for CodeDeploy then I should hopefully be able to figure out the rest.
Solved. When the CodeBuild step was created, from the AWS Template for Maven, it defaults to a CodeBuild Buildspec.yml file, rather than the one in the codebase - rather annoyingly - and it doesn't tell you it's doing that.
When I moved the buildspc.yml file contents into the AWS Console Buildspec section within CodeBuild then things started to work again.