generated from arafkarsh/ms-springboot-324-java-22-jakarta-ee-10
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcompile
executable file
·83 lines (83 loc) · 4.88 KB
/
compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
# -------------------------------------------------------------------------------------------
# @author: Araf Karsh Hamid
# -------------------------------------------------------------------------------------------
# Developer Local Compile Process
# ===========================================================================================
# 1. Clean up the target folder
# 2. Generate the Build Number (from git commit count) and Build Date
# 3. Build the Service
# 4. Copy the jar file to the Lib Folder
# 5. Start the Service using ./run script and then test it with ./test script
#
# After the Successful build and Startup of the Service, It should show the Build No. & Date
# -------------------------------------------------------------------------------------------
SERVICE=`getServiceName`
CONTAINER=`getServiceName 4`
ORG=`getServiceName 1`
echo "---------------------------------------------------------------------------------------"
echo "1. Compiling $ORG/$SERVICE Microservice"
echo "---------------------------------------------------------------------------------------"
#echo "Changing Logback Log File Name: /tmp/$SERVICE-server.%d{yyyy-MM-dd}.%i.log"
#echo "---------------------------------------------------------------------------------------"
#sed -i -r "s/microservice/$SERVICE/g" src/main/resources/logback.xml
#sed -i -r "s/microservice/$SERVICE/g" src/main/resources/logback-test.xml
echo "Clean up the target folder: mvn clean"
echo "---------------------------------------------------------------------------------------"
mvn clean
# -------------------------------------------------------------------------------------------
echo "Git Commit Count = "`git rev-list HEAD --count`
echo "---------------------------------------------------------------------------------------"
generateBuildNumber $SERVICE
# -------------------------------------------------------------------------------------------
echo "2. Build the $ORG/$SERVICE Microservice : mvn -e package"
echo "---------------------------------------------------------------------------------------"
mvn -e package
mvnCompRV=$?
# -------------------------------------------------------------------------------------------
if [ $mvnCompRV == 0 ]
then
echo "---------------------------------------------------------------------------------------"
echo "2.1 Compiling Service > $ORG/$SERVICE :: SUCCESS"
echo "---------------------------------------------------------------------------------------"
echo "2.2 Copy the Fat and Thin jar files and the libs to the Docker Directory (src/docker)"
cp target/*service*-spring-boot.jar src/docker/$CONTAINER-spring-boot.jar
#cp target/*service*?.?.?.jar src/docker/$CONTAINER-thin.jar
#cp target/libs/* src/docker/libs/
echo "2.3 Copy the application.properties File to the Docker Directory (src/docker)"
cp src/main/resources/application.properties src/docker/
cp src/main/resources/application-dev.properties src/docker/
cp src/main/resources/application-staging.properties src/docker/
cp src/main/resources/application-prod.properties src/docker/
echo "2.4 Copy the application.properties Files to current directory."
cp src/main/resources/application.properties .
cp src/main/resources/application-dev.properties .
cp src/main/resources/application-staging.properties .
cp src/main/resources/application-prod.properties .
echo "2.5 Copy the logback-spring xml Files to current directory."
cp src/main/resources/logback-spring.xml .
cp src/main/resources/logback-spring-scope.xml .
cp src/main/resources/logback-spring-appenders-json.xml .
cp src/main/resources/logback-spring-appenders-text.xml .
echo "---------------------------------------------------------------------------------------"
echo "2.6. Building the Container for $ORG/$SERVICE Service ..... "
echo "---------------------------------------------------------------------------------------"
cd src/docker
build
echo "---------------------------------------------------------------------------------------"
echo "3. $SERVICE Microservice Build Process Completed Successfully! ........... "
echo "---------------------------------------------------------------------------------------"
echo "3.1 Start the Service using "
echo " run (Run the SpringBoot App) OR"
echo " cd src/docker"
echo " start (Start the Container)"
echo "3.2 Then to test it with"
echo " test (To Test the SpringBoot App)"
echo "---------------------------------------------------------------------------------------"
echo "3.3 After the Successful build and Startup of the Service, It should show the Build No. & Date"
echo "---------------------------------------------------------------------------------------"
else
echo "---------------------------------------------------------------------------------------"
echo "2.99 Compiling Service > $ORG/$SERVICE :: FAILED!!!"
echo "---------------------------------------------------------------------------------------"
fi