maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Latombe <vincent.lato...@gmail.com>
Subject Re: Why is "mvn validate compile" different from "mvn validate; mvn compile"?
Date Thu, 07 Nov 2013 20:19:04 GMT
Hi,

It doesn't work because in Maven, dependencies are resolved prior to any
plugin execution (for each module contained in the reactor). Which
dependencies (compile, runtime, test) are resolved depend on what is
required by the various plugins that are be called in the lifecycle
(depending on the phase you called)

That's why mvn validate works : it only execute the execution you defined,
and this desn't require any dependency resolution
Whilest mvn compile doesn't : compile phase has a maven-compiler-plugin
execution which requires dependency resolution for scope compile, and this
happens before any plugin execution.


Vincent


2013/11/7 Alexander Kriegisch <Alexander@kriegisch.name>

> Only "mvn compile" yields the exact same result as "mvn validate compile",
> I just did it like this explicitly to make a point and show clearly what
> hapens. So again: Why, pray tell, does my two-phase build work if first I
> only do "mvn validate" and then "mvn compile", but not with only "mvn
> compile"? The question is still unanswered. Two people told me I made a
> mistake but did not explain which one and where the different behaviour
> comes from.
>
> If it helps I can send logs of "mvn -X ..." when I am back in office so
> you can see the difference if my explanation is not good enough. I thought
> it was. :-(
>
>
>
> > Am 07.11.2013 um 18:04 schrieb "Manfred Moser" <manfred@mosabuam.com>:
> >
> > You should not use either call. The validate phase is automatically run
> > before the compile phase as part of the default lifecycle
> >
> > Just use
> >
> > mvn compile
> >
> > In general it does not make sense to call multiple phases of the same
> > lifecycle since each phase invocation will run all phases up to and
> > including the phase mentioned.
> >
> > manfred
> >
> >> Hi.
> >>
> >> I have used mvn for a while, but am by no means an expert, so if I am
> >> asking an obvious question please pardon me and answer it anyway if you
> >> can. Thanks.
> >>
> >> I have bound some plugin executions to the validate phase because I need
> >> them to happen before compile. If I execute
> >>
> >>    mvn validate
> >>    mvn compile
> >>
> >> everything is fine. But if I call
> >>
> >>    mvn validate compile
> >>
> >> Maven behaves differently. What I do during validate is download
> external,
> >> non-mavenised (as in unavailable on Central) dependencies and install
> them
> >> locally if they are not registered in my local repo yet. Those
> >> dependencies are used in the compile phase. Now if I seperate the two
> >> calls it works, but if I do it in one mvn call and rely on the order of
> >> phases, Maven breaks my build by checking for remote and local artifact
> >> availability *before* actually starting the validate stuff from my POM.
> If
> >> I run "mvn -X ..." I can clearly see the difference.
> >>
> >> Am I doing anything wrong? Can I force Maven to actually do what is
> >> described in the documentation, i.e. perform the whole validate phase
> with
> >> all executions bound to it in my POM *before* doing anything else
> related
> >> to the compile phase such as trying to download dependencies?
> >>
> >> Thank you
> >> --
> >> Alexander Kriegisch
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message