Skip to content

Commit b1b6ed7

Browse files
authored
Update buildspec.yml
1 parent ef05922 commit b1b6ed7

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

buildspec.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
version: 0.2
2-
2+
33
phases:
44
install:
55
runtime-versions:
6-
java: corretto11 # Use a supported version (corretto11 or corretto8)
6+
java: corretto11
77
commands:
8-
- yum update -y
9-
- yum install -y maven
8+
- echo "Installing Java version 11 ..."
9+
- export JAVA_HOME="$JAVA_11_HOME"
10+
- export JRE_HOME="$JRE_11_HOME"
11+
- export JDK_HOME="$JDK_11_HOME"
12+
- for tool_path in "$JAVA_HOME"/bin/*;
13+
do tool=`basename "$tool_path"`;
14+
if [ $tool != 'java-rmi.cgi' ];
15+
then
16+
update-alternatives --list "$tool" | grep -q "$tool_path" \
17+
&& update-alternatives --set "$tool" "$tool_path";
18+
fi;
19+
done
20+
- mvn clean package
1021

1122
pre_build:
1223
commands:
13-
- echo Nothing to do in the pre_build phase...
24+
- echo "Nothing to do in the pre_build phase..."
1425

1526
build:
1627
commands:
17-
- echo Build started
18-
- mvn clean package
28+
- echo "Build started"
29+
- scp -i $narsan.pem target/webapp.war ec2-user@13.126.207.243:/home/ec2-user/webapp.war
30+
# Replace "/path/to/your/private-key.pem", "your-app.war", "user", "your-linux-machine-ip", and "/path/to/tomcat/webapps/" with your actual values
1931

2032
post_build:
2133
commands:
22-
- echo Build completed
23-
- aws ssm get-parameter --name arn:aws:ssm:us-east-1:787367675716:parameter/maddy-test --with-decryption --query "Parameter.Value" --output text > private_key.pem
24-
- scp -i private_key.pem target/webapp.war ec2-user@13.126.207.243:/home/ec2-user/webapp.war
34+
- echo "Build completed"
35+
- echo "Additional post_build commands, if any"

0 commit comments

Comments
 (0)