guang
2023-04-23 9e1c8d19bbca288b74464e90b75c9c1fe710ec1e
提交 | 用户 | age
9e1c8d 1 <?xml version="1.0" encoding="UTF-8"?>
G 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5     <modelVersion>4.0.0</modelVersion>
6
7     <groupId>com.hx.gitee</groupId>
8     <artifactId>phi-other-service</artifactId>
9     <version>1.0-SNAPSHOT</version>
10     <packaging>jar</packaging>
11
12     <parent>
13         <groupId>org.springframework.boot</groupId>
14         <artifactId>spring-boot-starter-parent</artifactId>
15         <version>2.6.2</version>
16     </parent>
17
18     <properties>
19         <mybatis.version>1.1.1</mybatis.version>
20
21         <dist>target/build</dist>
22         <res>target/build/resources</res>
23         <dist-tmp>target/build/tmp</dist-tmp>
24         <app-name>${project.artifactId}-${project.version}</app-name>
25         <real-app-name>${project.artifactId}</real-app-name>
26     </properties>
27
28     <dependencies>
29
30         <dependency>
31             <groupId>org.springframework.boot</groupId>
32             <artifactId>spring-boot-starter</artifactId>
33             <exclusions>
34                 <exclusion>
35                         <groupId>ch.qos.logback</groupId>
36                         <artifactId>logback-classic</artifactId>
37                 </exclusion>
38                 <exclusion>
39                     <groupId>org.springframework.boot</groupId>
40                     <artifactId>spring-boot-starter-logging</artifactId>
41                 </exclusion>
42             </exclusions>
43         </dependency>
44
45         <dependency>
46             <groupId>org.springframework.boot</groupId>
47             <artifactId>spring-boot-starter-log4j2</artifactId>
48         </dependency>
49
50         <dependency>
51             <groupId>com.hx.gitee</groupId>
52             <artifactId>hx-common</artifactId>
53             <version>1.0-SNAPSHOT</version>
54             <exclusions>
55                 <exclusion>
56                     <groupId>javax.servlet</groupId>
57                     <artifactId>servlet-api</artifactId>
58                 </exclusion>
59             </exclusions>
60         </dependency>
61
62         <dependency>
63             <groupId>com.hx.gitee</groupId>
64             <artifactId>hx-auto</artifactId>
65             <version>2.0-SNAPSHOT</version>
66             <scope>compile</scope>
67         </dependency>
68
69         <dependency>
70             <groupId>com.alibaba</groupId>
71             <artifactId>druid-spring-boot-starter</artifactId>
72             <version>1.1.23</version>
73         </dependency>
74
75         <dependency>
76             <groupId>org.springframework.boot</groupId>
77             <artifactId>spring-boot-starter-tomcat</artifactId>
78             <!--<scope>provided</scope>-->
79         </dependency>
80
81     </dependencies>
82
83     <profiles>
84         <profile>
85             <id>local</id>
86             <properties>
87                 <environment>local</environment>
88             </properties>
89         </profile>
90         <profile>
91             <id>prod</id>
92             <properties>
93                 <environment>prod</environment>
94             </properties>
95         </profile>
96     </profiles>
97
98     <build>
99         <resources>
100             <resource>
101                 <directory>src/main/java</directory>
102                 <includes>
103                     <include>**/*.xml</include>
104                 </includes>
105             </resource>
106             <resource>
107                 <directory>src/main/resources</directory>
108                 <excludes>
109                     <exclude>application-*.properties</exclude>
110                     <exclude>log4j2-*.xml</exclude>
111                 </excludes>
112             </resource>
113             <resource>
114                 <directory>src/main/resources</directory>
115                 <includes>
116                     <include>application-${environment}.properties</include>
117                     <include>log4j2-local.xml</include>
118                     <include>log4j2-prod.xml</include>
119                     <include>log4j2-${environment}.xml</include>
120                 </includes>
121             </resource>
122         </resources>
123
124         <plugins>
125             <!--**********分离资源文件及依赖包打包配置*************-->
126             <plugin>
127                 <groupId>org.apache.maven.plugins</groupId>
128                 <artifactId>maven-dependency-plugin</artifactId>
129                 <executions>
130                     <execution>
131                         <id>copy-dependencies</id>
132                         <phase>package</phase>
133                         <goals>
134                             <goal>copy-dependencies</goal>
135                         </goals>
136                         <configuration>
137                             <outputDirectory>target/lib</outputDirectory>
138                             <excludeTransitive>false</excludeTransitive>
139                             <stripVersion>false</stripVersion>
140                             <includeScope>runtime</includeScope>
141                         </configuration>
142                     </execution>
143                 </executions>
144             </plugin>
145
146             <plugin>
147                 <groupId>org.apache.maven.plugins</groupId>
148                 <artifactId>maven-jar-plugin</artifactId>
149                 <configuration>
150                     <excludes>
151                         <exclude>**/*.properties</exclude>
152                         <exclude>**/log4j*.xml</exclude>
153                         <exclude>static/**</exclude>
154                         <exclude>templates/**</exclude>
155                     </excludes>
156                 </configuration>
157             </plugin>
158
159             <plugin>
160                 <groupId>org.springframework.boot</groupId>
161                 <artifactId>spring-boot-maven-plugin</artifactId>
162                 <configuration>
163                     <mainClass>com.hx.phiappt.PhiPreSysApplication</mainClass>
164                     <layout>ZIP</layout>
165                     <includes>
166                         <include>
167                             <groupId>non-exists</groupId>
168                             <artifactId>non-exists</artifactId>
169                         </include>
170                     </includes>
171                 </configuration>
172                 <executions>
173                     <execution>
174                         <goals>
175                             <goal>repackage</goal>
176                         </goals>
177                         <configuration>
178                             <classifier>classes</classifier>
179                             <attach>false</attach>
180                         </configuration>
181                     </execution>
182                 </executions>
183             </plugin>
184             <plugin>
185                 <groupId>org.apache.maven.plugins</groupId>
186                 <artifactId>maven-antrun-plugin</artifactId>
187                 <executions>
188                     <execution>
189                         <phase>package</phase>
190                         <goals>
191                             <goal>run</goal>
192                         </goals>
193                         <configuration>
194                             <target>
195                                 <delete dir="${dist}" />
196                                 <mkdir dir="${dist}" />
197                                 <mkdir dir="${dist-tmp}" />
198                                 <mkdir dir="${res}" />
199                                 <copy file="target/${app-name}.jar" tofile="${dist-tmp}/${app-name}.jar" />
200                                 <unzip src="${dist-tmp}/${app-name}.jar" dest="${dist-tmp}" />
201                                 <delete file="${dist-tmp}/${app-name}.jar" />
202                                 <move file="target/${app-name}-classes.jar" tofile="${dist}/${real-app-name}.jar"/>
203                                 <move todir="${dist}/lib">
204                                     <fileset dir="target/lib" />
205                                 </move>
206
207                                 <delete dir="${dist-tmp}" />
208
209                                 <copy todir="${res}">
210                                     <fileset dir="target/classes">
211                                         <include name="**/static/**" />
212                                         <include name="**/templates/**" />
213                                     </fileset>
214                                 </copy>
215                                 <copy todir="${res}">
216                                     <fileset dir="target/classes">
217                                         <include name="**/*.properties" />
218                                         <include name="**/*.xml" />
219                                         <include name="**/*.yml" />
220                                         <exclude name="**/*Mapper.xml"/>
221                                     </fileset>
222                                 </copy>
223                             </target>
224                         </configuration>
225                     </execution>
226                 </executions>
227             </plugin>
228         </plugins>
229     </build>
230
231 </project>