The Maven lifecycle doesn't include deployment to the server(s) where it
will be execute, e.g. production. The last phase is called 'deploy' and that
confuses some people as it is about publishing the artifact to a repo.
That's where Maven ends typically. What you then need to do is to take the
artifact from the repo and deploy it to the prod server for example. And you
can do that in different ways, one being using ant like you do, another by
manually copy, etc.

In your text I se that you only do mvn package when you build. What you
should be doing is mvn deploy (or actually use the release plugin to cut a
release) to get your artifact deloyed/published to a repo. Otherwise it will
only be available locally on your machine. Invest in setting up a repo
manager like Nexus (or Artifactory). It will pay back.

/Anders

On Fri, May 7, 2010 at 03:32, Jan <raghure...@gmail.com> wrote:

> Hi All,
>
> I've been using maven for sometime, but i always used it only for building
> artifact and to deploy i used ant, but whenever someone asked me why not
> use
> maven for both build and deploy to servers i couldn't really tell them why?
>
> Here is my requirement we have different env like DEV,SIT,UAT and PROD and
> now i use maven to build the code at DEV stream in clearcase, at the end of
> successful compilation i create a ear using maven ear plugin create a ear
> and store it some central location. for this i use a command mvn -e clean
> package. After this whenever there is a request to deploy the ear file at
> different times i take the ear file from this central location and deploy
> it
> to different environment without rebuilding again, so for this purpose
> initially i tried adding the my server related plugin at install phase then
> tried running mvn -e clean install but whenever i did maven goes thru full
> life cyle again like compiling,packaging again, but i didn't want on this
> way i just want to take the ear file already created and just run that
> "install" phase, i tried the same in different phase and tried to run just
> that goal, but never got it working. so finally i decided my self that this
> is not possible unless we want to go thru full lifecyle
> (compile,package,deploy) every time, so moved to ant it was very easy with
> ant. But time to time i do see lot of emails on this forum asking about
> failure in deployments, is everyone is doing full lifecycle every time ? no
> one just compile and package only one time then stage the artifact then
> deploy it from there using maven? is there something i'm missing here ?
>
> Any one has any thought on this?
>

Reply via email to