简体   繁体   English

在Teamcity构建和部署后运行Spring Boot应用程序

[英]Running spring boot app after teamcity build and deploy

Is there another way to run deployed spring boot application on server than *sh script? 除了* sh脚本,还有其他方法可以在服务器上运行已部署的spring boot应用程序吗? My idea is create .sh script which will start app (java -jar name...). 我的想法是创建.sh脚本,它将启动应用程序(java -jar名称...)。 This solution is simple but have one disadvantage - I have application version in the file name. 此解决方案很简单,但有一个缺点-文件名中有应用程序版本。 I can trust that there will be only one *jar file and run it - but I am not sure that it is best solution. 我可以相信只有一个* jar文件可以运行它-但我不确定这是最好的解决方案。

What do you think? 你怎么看?

You could use maven-assembly-plugin to bundle your application jar and sh script onto one zip file. 您可以使用maven-assembly-plugin将应用程序jar和sh脚本捆绑到一个zip文件中。 In this case you could use maven resource filtering to put replace ${version} placeholder in your sh with exact version of your jar during maven build. 在这种情况下,您可以使用maven资源过滤在maven构建过程中将jar的确切版本替换${version}占位符放在sh中。

If your jar has name like this: `my-project-.jar1 then your sh script will look like this: 如果您的jar名称如下:`my-project-.jar1,那么您的sh脚本将如下所示:

java -jar my-project-${version}.jar

During build maven will replace ${version} with value from pom.xml. 在构建期间,maven将用pom.xml中的值替换${version} So after build you need to unpack zip (or tar.gz) and execute sh script. 因此,构建后,您需要解压缩zip(或tar.gz)并执行sh脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM