-
Notifications
You must be signed in to change notification settings - Fork 1
/
pom.xml
173 lines (162 loc) · 8.6 KB
/
pom.xml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.syscomz</groupId>
<artifactId>syscomzservices</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<!-- Microservice Modules -->
<modules>
<module>customer</module>
<module>fraud</module>
<module>eureka-server</module>
<module>clients</module>
<module>notification</module>
<module>apigw</module>
<module>amqp</module>
</modules>
<name>syscomzservices</name>
<url>https://www.syscomz.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source> <!-- I am using openjdk-17 -->
<maven.compiler.target>17</maven.compiler.target> <!-- I am using openjdk-17 -->
<spring.boot.maven.plugin.version>2.5.7</spring.boot.maven.plugin.version>
<spring.boot.dependencies.version>2.5.7</spring.boot.dependencies.version>
<spring.cloud-version>2020.0.3</spring.cloud-version>
<!-- The name of the image that we will produce from Docker Hub -->
<!-- It will take the <artifactId>notification</artifactId> and the <version>1.0-SNAPSHOT</version> from every single microservice -->
<!-- Example: bdostumski/notification:1.0-SNAPSHOT or something -->
<image>bdostumski/${project.artifactId}:${project.version}</image>
</properties>
<!-- All submodules can pick the dependency that they want -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.dependencies.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<!-- Spring Cloud Dependency provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state) -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- All the submodules will have these dependencies by default, without explicitly importing them into their pom.xml file -->
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<!-- OpenFeign dependency -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.8.8</version>
</dependency>
</dependencies>
<build>
<!-- Again in this pluginManagement all submodules can pick the dependency that they want -->
<pluginManagement>
<plugins>
<!-- This plugin build the artifacts -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.maven.plugin.version}</version>
<!-- Because I am not using default parent pom, with spring-boot-starter-parent where the configuration below is pre-configured. -->
<!-- I need to add repackage goal by hand. Without this we won't be able to run the applications -->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Jib to containerize our Java code -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.1.4</version>
<!-- default configuration for all our microservices -->
<!-- Check for Java your version in google search for "adoptopenjdk docker" because it is deprecated go Eclipse Temurin -->
<!-- Because I want to use exact same image.
Or if this image eclipse-temurin:17 is changed internal at some point of a time in the future (I want to use the image that I am use today).
The hash is added by me @sha256:2b47a8ea946ce1e5365a1562414ed576e378b7b670cadff3fb98ebecf2890cdc to make share that I am using the exact same image -->
<configuration>
<from>
<image>
eclipse-temurin:17@sha256:2b47a8ea946ce1e5365a1562414ed576e378b7b670cadff3fb98ebecf2890cdc
</image>
<!-- Configuration for different architectures -->
<!-- The platform configuration will not let me build Docker Images locally, may be it is a bug -->
<platforms>
<!-- <platform>-->
<!-- <architecture>arm64</architecture>-->
<!-- <os>linux</os>-->
<!-- </platform>-->
<platform>
<architecture>amd64</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
<!-- The image that we want the JIB to build -->
<to>
<tags>
<tag>latest</tag>
</tags>
</to>
</configuration>
<!-- I want to centralize this <execution> for all my microservice that's why I am move this code into main pom.xml below the <configuration> tag -->
<!-- If this execution is different for the other microservice than every microservice should have its own <execution> tag -->
<!-- For example, you can check the pom.xml configuration in apigw microservice where I am let commented example -->
<executions>
<execution>
<!-- After the package I want to run the goal below the <phase> -->
<phase>package</phase>
<goals>
<!-- This will build our image and push it to our Docker Registry -->
<goal>build</goal>
<!-- This will build tart file -->
<!-- <goal>buildTar</goal>-->
<!-- This will build local Docker Image -->
<!-- <goal>dockerBuild</goal>-->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<!-- Add Maven Compiler Plugin -->
<!-- This plugin is included into every single module -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>17</source> <!-- Java version -->
<target>17</target> <!-- Java version -->
</configuration>
</plugin>
</plugins>
</build>
</project>