🐛Fix: SpringBoot 项目打包

This commit is contained in:
2025-11-01 12:05:35 +08:00
parent d1d411d53d
commit 2c80f1eec8
6 changed files with 54 additions and 34 deletions
+1 -5
View File
@@ -10,6 +10,7 @@
</parent>
<artifactId>common</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
@@ -30,11 +31,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
</plugins>
</build>
+5 -1
View File
@@ -28,7 +28,7 @@ if [ $? -ne 0 ]; then
fi
# 进入工作目录
cd $WORK_DIR
cd "$WORK_DIR" || { echo "无法进入工作目录"; exit 1; }
# 打包各个模块
echo "正在打包各个模块..."
@@ -58,6 +58,10 @@ if [ $? -ne 0 ]; then
exit 1
fi
# 清理旧部署文件
echo "清理旧部署文件..."
rm -f "$DEPLOY_DIR/lark.jar" "$DEPLOY_DIR/movie.jar" "$DEPLOY_DIR/weather.jar"
# 复制jar包到部署目录
echo "复制jar包到部署目录..."
cp movie/target/movie-*.jar $DEPLOY_DIR/movie.jar
+7 -8
View File
@@ -12,6 +12,13 @@
<artifactId>lark</artifactId>
<dependencies>
<dependency>
<groupId>cn.hezhaohui</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -38,13 +45,6 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hezhaohui</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
@@ -60,7 +60,6 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>cn.hezhaohui.lark.LarkApplication</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
+7 -6
View File
@@ -12,6 +12,12 @@
<artifactId>movie</artifactId>
<dependencies>
<dependency>
<groupId>cn.hezhaohui</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -24,11 +30,7 @@
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>cn.hezhaohui</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@@ -52,7 +54,6 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>cn.hezhaohui.movie.MovieApplication</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
+27 -8
View File
@@ -53,14 +53,33 @@
</dependencyManagement>
<!-- 构建配置 -->
<build>
<plugins>
<!-- 编译插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>21</source>
<target>21</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<!-- 编译插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- Maven 属性 -->
+7 -6
View File
@@ -12,6 +12,12 @@
<artifactId>weather</artifactId>
<dependencies>
<dependency>
<groupId>cn.hezhaohui</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -33,11 +39,7 @@
<artifactId>hutool-all</artifactId>
<version>5.8.27</version>
</dependency>
<dependency>
<groupId>cn.hezhaohui</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@@ -57,7 +59,6 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>cn.hezhaohui.weather.WeatherApplication</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>