11

I have .war file and I need to do "deploy script". Is it possible to do this with maven? Can I execute only deploy phase of lifecycle? Or it will be better to use some other instruments for deployment like ant, gant etc.

gnat
  • 6,213
  • 108
  • 53
  • 73
Sergey
  • 1,059
  • 3
  • 21
  • 35

2 Answers2

4

No, you can't skip phases. The mvn phase-x command always means "run all phases until phase-x, inclusive". Some plugins, however can detect if there have been changes since their last execution and decide (on their own) not to run — the subsequent build is faster.

I'm not sure what exactly you want to achieve — perhaps you could take a look at Maven assembly plugin?

MaDa
  • 10,511
  • 9
  • 46
  • 84
  • I'm sorry that I'm not clearly expressed my purpose. We supply to the customer a .war file, and my purpose is to make installer for this .war, which would perform such tasks as finding servlet container, run it, if it does not launch, deploy or redeploy application, replace some property in .properties files and some other specific tasks. I had an idea to write a own maven plugin for special problems, and to use cargo maven plugin for “standard” deploy tacks. However the answer is very clear. Thank you for it. I will look for other tools that are more appropriate for my task. – Sergey Jan 16 '12 at 10:17
  • @Sergey When you've said that, the assembly plugin seems at least like a path worth examining. I'd start with creating a separate project (only for running the assembly plugin) that would use this war as a dependency. I'm not sure with replacing the .properties files, though, it might not be doable this way. – MaDa Jan 16 '12 at 11:30
  • Thank you! I think that your advice is the way to solving my problem. – Sergey Jan 17 '12 at 09:58
1

you can (now) skip phases by directly calling the goal via

mvn <plugin>:<goal>

e.g.

mvn compiler:compile

see this answer for details

Andreas Covidiot
  • 4,286
  • 5
  • 51
  • 96