1

how would i get maven to deploy my app for me.

i want to be able to type

mvn deply:devserver (or something like that) and have it do the following things

SCP all dependency jars to the remote devserver/var/lib/tomcat6/shared/company folder

SCP the war file to the remote devserver/var/lib/tomcat6/webapps folder

and since i can already hear the statements/questions "why are you doing it like this, you can just build the war with dependencies in it" bla bla bla i will answer. this server is going to be running about 35 different war files (be gentle i inherited this project) all using the same dependencies so i don't see the point of having the tomcat classloader loading the same 50 or so libraries 35 times. id rather have tomcat load them on startup and share them with the webapps.

and NO, manager is not installed on this instance of tomcat so please don't go there. security guys wont let us install the management console on a publicly visible server so all the deployments must be via SCP file copies.

i could do this in about 5 minutes with ant and i havn't eliminated the possibility of simply writing a shell script to do it but i would like to give maven a chance first.

scphantm
  • 4,293
  • 8
  • 43
  • 77

1 Answers1

1

You should script the 'deploy' of the code to the server. If you choose to use Ant, do it, but Maven is not the right tool for this job.

The Maven 'deploy' goal is used to deploy built artifacts to a repository server for other projects to be able to download as dependencies. It is not the 'deploy' you are thinking of.

If you really need this done by Maven though, there is a maven ant plugin which lets you run Ant tasks in Maven and you could bind this to your deploy step. I would advise against this though because it very much goes against the conventions of using Maven as a build tool.

Jesse Webb
  • 43,135
  • 27
  • 106
  • 143
  • cool, thanks. i will knock out a quick shell script to do it then. – scphantm Aug 12 '11 at 19:28
  • i ended up writing a shell script to do this – scphantm Aug 31 '11 at 20:51
  • Shell script is good but you might also want to consider a cross-platform scripting language instead unless you are absolutely positive you will only ever run it on linux/unix. If you want to be able to do it from any environment, Ant, python, or scala are my favourite choices. – Jesse Webb Sep 01 '11 at 19:33