Jenkins部署SpringBoot项目报错:ERROR: Step ‘Deploy war/ear to a container’ aborted due to exception:

ERROR: Step ‘Deploy war/ear to a container’ aborted due to exception: 
java.lang.InterruptedException: [DeployPublisher][WARN] No wars found. Deploy aborted. %n
	at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:107)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:112)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
	at hudson.model.Build$BuildExecution.post2(Build.java:186)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
	at hudson.model.Run.execute(Run.java:1919)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE

报错出现在,构建war包完成之后,要部署到Tomcat容器时候,出现如上错误。

从错误 "No wars found" 中可以大致看出,意思是:找不到war包。

然后我仔细看了一下,Jenkins给我部署出来的东西,发现:

jenkins给我打包了jar,但是我配置的Jenkins找war包取部署,所以就找不到了。

解决方案:

(1)方案一:修改Jenkins部署jar包

(2)方案二:修改pom.xml重新打包

修改源代码中的pom.xml文件,添加<packaging>打包类型为war,然后上传源代码到git,重新通过Jenkins部署即可。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐