- pom.xml: - 添加finalName配置去除版本号 - maven-jar-plugin排除资源文件 - 禁用spring-boot-maven-plugin repackage - 各服务移除冗余的plugin配置 - assembly.xml: - 主JAR放根目录(仅服务代码) - lib目录放依赖JAR - start.sh: - 支持java -cp classpath模式启动 - 从service.properties读取MAIN_CLASS - 向后兼容fat jar模式 - service.properties: - 所有服务添加MAIN_CLASS配置 优势: - 主JAR从131MB缩小到103KB - 多服务部署可共享lib目录 - 资源文件外置便于修改
97 lines
3.4 KiB
XML
97 lines
3.4 KiB
XML
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
<modelVersion>4.0.0</modelVersion>
|
|
|
|
<parent>
|
|
<groupId>com.fundplatform</groupId>
|
|
<artifactId>fundplatform</artifactId>
|
|
<version>0.0.1-SNAPSHOT</version>
|
|
</parent>
|
|
|
|
<artifactId>fund-report</artifactId>
|
|
<name>fund-report</name>
|
|
<description>Fund-report Service</description>
|
|
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>com.fundplatform</groupId>
|
|
<artifactId>fund-common</artifactId>
|
|
<version>0.0.1-SNAPSHOT</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-web</artifactId>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.baomidou</groupId>
|
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
<version>3.5.5</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.mysql</groupId>
|
|
<artifactId>mysql-connector-j</artifactId>
|
|
</dependency>
|
|
<!-- AOP -->
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-aop</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Jackson JSR310 for Java 8 Date/Time -->
|
|
<dependency>
|
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
</dependency>
|
|
|
|
<!-- Logstash Logback Encoder (用于ELK) -->
|
|
<dependency>
|
|
<groupId>net.logstash.logback</groupId>
|
|
<artifactId>logstash-logback-encoder</artifactId>
|
|
<version>7.4</version>
|
|
</dependency>
|
|
|
|
<!-- Nacos服务注册发现 -->
|
|
<dependency>
|
|
<groupId>com.alibaba.cloud</groupId>
|
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
|
</dependency>
|
|
|
|
<!-- OpenFeign -->
|
|
<dependency>
|
|
<groupId>org.springframework.cloud</groupId>
|
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<plugins>
|
|
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-assembly-plugin</artifactId>
|
|
<version>3.6.0</version>
|
|
<configuration>
|
|
<descriptors>
|
|
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
|
</descriptors>
|
|
<finalName>${project.artifactId}</finalName>
|
|
<appendAssemblyId>false</appendAssemblyId>
|
|
<outputDirectory>${project.basedir}/../deploy</outputDirectory>
|
|
</configuration>
|
|
<executions>
|
|
<execution>
|
|
<id>make-assembly</id>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>single</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
|
|
</project>
|