Creating a buildspec file
To create a buildspec.yml
file for our aws-code-pipeline
microservice, perform the following instructions:
- Open the VS Code IDE, click File | New File, name the file
buildspec.yml
, and save the file:
Figure 8.17 – VS Code create new buildspec.yml file
- Add the following code to the
buildspec.yml
file and click File | Save. In this file, we are installingcorretto11
Java for compiling our source code in theinstall
phase, and in thepre_build
phase we just print the Java version, although in a more complex application, we could do many more things. In thebuild
phase, we run our test cases, while in thepost_build
phase we package the Spring Boot JAR file, which we publish as an artifact in theartifact
section:version: 0.2 phases: install: runtime-versions: java: corretto11 pre_build: commands: ...