When using Spring and Maven, what is the best way to deploy code on a server?

I have a project that uses Spring. Each time I deploy, I run a “package” of the maven target, which runs all the 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 close the server, replace the war, and start the server again.

Sometimes, when they make changes to the database schema, I have to manually execute the sql script migration.

Is there a better workflow that I can use? Since the project’s war file is 60 MB, I have to wait 10-12 minutes to upload it to the server. If I understand that I need to change one little thing, I have to complete the whole process again.

This is doubly bad for me, because on DSL downloading bandwidth kills the download speed, so the Internet does not work at all. Even working on a project and fulfilling maven goals is slow because they use an internet connection to search for dependencies all the time.

Is there a better way to work? Thanks.

+4
source share
1 answer

First of all, you can avoid manual ftp copies using the Maven Deploy plugin. You can find a way to deploy ftp projects at this URL:

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

The second question is the question about your project: the normal size of your WAR?
I heard about configurations that have an extra jar built in to avoid overwriting META-INF / spring metadata when creating the final jar. If you are in this situation, you may be interested in this:

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

+1
source

All Articles