Deploy Only Diffs in Webapp with Maven to Remote Server
I am using cargo:deploy with maven to deploy applications to servers. This works well, but I recently tried using CloudBees. They have a similar plugin for their infrastructure. However, it deploys only differences betwe开发者_开发知识库en the old WAR and the new WAR so it is significantly faster. Where cargo:deploy takes me 4 to 6 minutes, the CloudBees method takes less than a minute.
Are there any plugins for Maven that will allow me to deploy only my changes to my own app server? Right now I'm using Tomcat, but would consider switching application servers if there was a good solution for something else.
You need server side support for receiving the delta, which is where we (cloudbees) get to invoke our secret sauce.
What you would need is a deployment service on the target server that understands whatever delta format gets uploaded.
It is not to tricky to do in some ways... The war has built in checksums, so if an entry in the war has the same path, last-modified, Crc and size then it is a good candidate for exclusion from the delta, so you take a safer hash or two (sha-256 and md5 for example, to give to different functions to compare with) and if those hashes are the same! Exclude from the delta.
A fancy tomcat-deployer web app could support such deployment, but you'd want to lock it down for production, but anyway why host yourself when you can GSETDIFY
If you are interested only in Tomcat, you can use the Tomcat Plugin for Maven
It's not difficult to configure, just check the Tomcat manager application url because it is changed from Tomcat 6 (http://tomcat_server:8080/manager/) to Tomcat 7 (http://tomcat_server:8080/manager/html).
The plugin runs after the "package" build phase, so it does direct deploy of the generated war to a remote server where Tomcat is running.
I find I get out of memory errors in the server, after a few cargo deployments. You could use the maven wagon ssh extension. It could upload based on the expanded war. Here is the usage doc:
http://mojo.codehaus.org/wagon-maven-plugin/usage.html
But not sure how to get it to only upload changed files. With ant there was a file cache component which would cache the checksum of the files, and only reupload if the checksum had changed.
Even once you have uploaded the files, a restart might be required as tomcat is not very good with hot deployments.
精彩评论