windows 安装 spring boot 服务 及打包

 

引用:https://www.cnblogs.com/passedbylove/p/11466584.html

 

https://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/

 

IDEA  下 Maven 打包

1、多项目注意打包报错:Could not find artifact com.xxx.xxx:xxx-xxx-yyy:

 解决方法:

在 xxx-xxx-yyy 此包下 运行 mvn deploy

IDEA  是-Maven->xxx-xxx-yyy(包名)->Lifecycle->deploy(右键Run Maven Build)

 

虽然上面可以打包成功,但好像Maven本地仓库不是最新的,所以新功能一直好像没生效。

找原因步骤如下:

1、新找包成功的包解压

2、BOOT-INF\lib下为本jar依赖的jar包

3、解压对应功能下jar包找到对应的类文件,拖入Idea中此时看到里面并没有添加的功能代码

4、不断有清理删除target文件夹,找包始终还是老版本(这步是浪费时间)

还是一个jar打包吧

报错:maven Error:(46,40) java: 错误: 找不到符号

1、网上说可能是文件编码文件、jdk版本不对(这些都是浪费时间)

后找到:https://blog.csdn.net/m0_55710969/article/details/121155947

原因:是你的项目经过修改后尚未编译,直接打包程序无法识别而导致,使用Maven命令重新编译即可。

idea 中选择对象项目, maven:compile、package、install

果然问题解决。

后一个依赖项目为又报错:Error:(5,30) java: 错误: 程序包com.sun.istack.internal不存在

网上说加下面pom.xml,但我没成功

复制代码
<dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>13.0</version>
        </dependency>
View Code
复制代码
SignInPasswordDecryptionFilter

后rebuild项目就对了

 

如果单元测试报错:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project myblog: There are test failures.


Please refer to D:\WorkGitHub\myblog\server\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.

路过的方法:

https://blog.csdn.net/cnds123321/article/details/123557011

 

 

 

 

 

下载Windows Service Wrapper

 本文下载了winsw-2.3.0-bin.exe。

新建一个目录aiplatformService

在目录里面新建一个aiplatformService.xml,同时把winsw-2.3.0-bin.exe重命名陈aiplatformService.exe

必须这么做,否则无法安装启动服务。

编辑aiplatfomService.xml文件

复制代码
复制代码
<?xml version="1.0" encoding="utf-8" ?>
<service>
    <id>aiPlat</id> <!-- must be unique -->
    <name>ai Platfrom Daemon</name>
    <description>ai平台演示程序</description>
    <executable>javaw</executable>
    <arguments>-jar "%BASE%\web-0.2.jar"</arguments>
    <logpath>%BASE%\log</logpath>
    <log mode="roll-by-time">
    <pattern>yyyy-MM-dd</pattern>   
    </log>
</service>
复制代码
复制代码

在目录中放入你的springboot项目,web-0.2.jar

在命令行 运行

复制代码
复制代码
安装服务命令
aiPlatService.exe install
启动服务

  E:\aiplatformService>aiPlatService.exe stop
  2019-09-05 15:59:31,974 INFO - Stopping the service with id 'aiPlat'

关闭服务

  E:\aiplatformService>aiPlatService.exe start
   2019-09-05 15:59:38,399 INFO - Starting the service with id 'aiPlat'

卸载服务命令  

aiPlatService.exe uninstall

sc delete aiPlat

复制代码
复制代码

 

posted @   三瑞  阅读(449)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示