Commit 203a5ee0 authored by wanghao's avatar wanghao

1调整打包方式

parent 1d2152f5
......@@ -16,57 +16,43 @@
</description>
<dependencies>
<!-- spring-boot-devtools -->
<!-- 原有依赖保持不变 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
<optional>true</optional>
</dependency>
<!-- swagger3-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.zehong</groupId>
<artifactId>zhmes-agecal-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.zehong</groupId>
<artifactId>zhmes-agecal-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.zehong</groupId>
<artifactId>zhmes-agecal-generator</artifactId>
</dependency>
</dependencies>
<build>
<!-- 最终JAR包名称:模块名-版本号.jar -->
<finalName>${project.artifactId}-${project.version}</finalName>
<finalName>zhmes-agecal-${project.version}</finalName>
<plugins>
<!-- 编译插件(继承父工程配置,保持版本一致) -->
<!-- 编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
......@@ -77,15 +63,14 @@
</configuration>
</plugin>
<!-- Spring Boot打包核心插件(生成可运行JAR) -->
<!-- Spring Boot 打包插件 - 关键修复 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.13.RELEASE</version> <!-- 与父工程Spring Boot版本完全一致 -->
<version>2.2.13.RELEASE</version>
<configuration>
<!-- 必须指定启动类(替换为你的实际主类全路径) -->
<!-- 请替换为您的实际启动类 -->
<mainClass>com.zehong.ZhMesAgecalApplication</mainClass>
<!-- 排除开发环境依赖(如devtools) -->
<excludes>
<exclude>
<groupId>org.springframework.boot</groupId>
......@@ -96,12 +81,108 @@
<executions>
<execution>
<goals>
<goal>repackage</goal> <!-- 重新打包为可执行JAR -->
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 复制依赖jar包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/zhmes-agecal-${project.version}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<!-- 排除主JAR,避免重复 -->
<excludeArtifactIds>${project.artifactId}</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<!-- 资源复制插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<!-- 复制配置文件 -->
<execution>
<id>copy-config</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/zhmes-agecal-${project.version}/conf</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.yaml</include>
<include>**/*.properties</include>
<include>**/logback.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<!-- 复制启动脚本 -->
<execution>
<id>copy-scripts</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/zhmes-agecal-${project.version}/bin</outputDirectory>
<resources>
<resource>
<directory>src/main/bin</directory>
<includes>
<include>*.sh</include>
<include>*.bat</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<!-- 复制主JAR包 -->
<execution>
<id>copy-main-jar</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/zhmes-agecal-${project.version}/lib</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
@echo off
title zhmes-agecal-admin
chcp 65001 > nul
setlocal
set "APP_HOME=%~dp0.."
set "APP_NAME=zhmes-agecal-3.5.0.jar"
set "JAVA_OPTS=-Xms1024m -Xmx2048m -Dfile.encoding=UTF-8"
set "SPRING_OPTS=--spring.config.location=../conf/application.yml"
echo Starting %APP_NAME% ...
echo JAVA_OPTS: %JAVA_OPTS%
echo SPRING_OPTS: %SPRING_OPTS%
cd /d "%APP_HOME%"
java %JAVA_OPTS% -jar "lib/%APP_NAME%" %SPRING_OPTS%
if %ERRORLEVEL% NEQ 0 (
echo Failed to start %APP_NAME%
pause
)
endlocal
\ No newline at end of file
@echo off
chcp 65001 > nul
setlocal
set "APP_NAME=zhmes-agecal-3.5.0.jar"
echo Stopping %APP_NAME% ...
for /f "tokens=1-2" %%i in ('jps -l ^| find "%APP_NAME%"') do (
echo Killing process: %%i %%j
taskkill /F /PID %%i
)
timeout /t 3 /nobreak > nul
echo Service stopped.
endlocal
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment