Java – what is the best way to deploy code to the server when using spring and Maven?

I have a project using spring Every time I deploy, I run the Maven target "package", which runs all tests and creates a war file Then I manually use the FTP program to copy the war file to the server Then I run a bash script to shut down the server, replace the war, and start the server again

Sometimes, when they make changes to the database schema, I have to run the SQL migration script manually

Can I use a better workflow? Because the war file of the project is 60MB, I have to wait 10-12 minutes to upload it to the server If I realize that I need to change a small thing, I must redo the whole process

This is double bad for me, because on DSL, the upload bandwidth will lead to the consumption of download bandwidth, so the Internet can't run at all Even running Maven targets on a project is slow because they always use an Internet connection to find dependencies

Is there a better way to work? thank you.

Solution

First, you can use the Maven deploy plug-in to avoid manual FTP replication

http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ftp.html

The second point is about your project: is your war size normal? I've heard of the configuration of embedding redundant jars to avoid meta - inf / spring. Inf when building the final jar The problem of handlers coverage If you encounter this situation, you may also be interested in it:

http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>