赞
踩
Spring Boot
项目打成jar
包。利用maven
插件(多模块项目只需在服务模块添加插件)<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> <skip>true</skip> <encoding>UTF-8</encoding> <compilerArguments> <verbose/> <bootclasspath>${java.home}/lib/rt.jar</bootclasspath> </compilerArguments> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lid/</classpathPrefix> <mainClass>主启动类</mainClass> </manifest> </archive> <!-- 排除配置文件 --> <excludes> <exclude>images/**</exclude> <exclude>markdown/**</exclude> </excludes> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> <include>**/*.yml</include> </includes> <filtering>true</filtering> </resource> </resources> </build>
@echo off
set JAVA_HOME=指定Java目录
set PATH=%JAVA_HOME%\bin;%PATH%
start javaw -Dfile.encoding=utf-8 -jar c:jar包位置 -Xms1024M -Xmx2048M -Xlog:disable -Xlog:exceptions=warning,safepoint=info,gc=trace,gc+heap=trace,logging=warning:file=/mnt/logs/gc.trace.log:uptime,level,tags,time,pid:filecount=5,filesize=10M -Duser.timezone=GMT+08 --spring.config.location=application.yml位置 -Djava.security.egd=file:/dev/./urandom
1、javaw
启动,后台运行无前台cmd
窗口
2、--spring.config.location
启动时指定配置文件,多个逗号隔开
3、-Dfile.encoding=utf-8
:Windows
下项目保存数据到数据库中,中文乱码问题。排除请求乱码,接收乱码。可能和windows
环境的默认编码(GBK
)有关,需要启动时指定utf-8
。
4、Windows
端口耗尽问题 TCP/IP 端口耗尽故障排除
regedit
进入注册表 ,HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters
REG_DWORD(64)
,命名为MaxUserPort
,设置值为60000,值类型为十进制,然后再新建一个命名为TCPTimedWaitDelay
,设置值为30,值类型为十进制netsh int ipv4 set dynamicport tcp start=2000 num=60000
@echo off chcp 65001 color 0A echo ===========Start to copy data=========== :start cls echo.请输入要关闭的端口号 set /p my_port= echo.你输入的端口号是:%my_port% echo 开始关闭执行脚本!!!!!!!!!!!!!! @echo off&setlocal EnableDelayedExpansion set Port= set Dstport=%my_port% for /F "usebackq skip=4 tokens=2,5" %%a in (`"netstat -ano -p tcp"`) do ( for /F "tokens=2 delims=:" %%k in ("%%a") do ( set Port=%%k ) echo !Port! %%b >>portandpid.txt ) for /F "tokens=2 delims=:" %%c in ("%1") do ( set Port=%%c ) for /F "tokens=1,2 delims= " %%d in (portandpid.txt) do ( echo %%d echo %Dstport% if %%d == %Dstport% taskkill /f /pid %%e ) del portandpid.txt set Port= set Dstport= goto :eof echo '结束了' pause
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。