Thanks to all. Simply knowing that this can't work will help me from beating my 
head against the wall trying to make it work.
Very much appreciate the explanations.

Andy


-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.conno...@gmail.com] 
Sent: Tuesday, March 05, 2013 8:20 AM
To: Maven Users List
Subject: Re: Initialize not running during Install?

Before Maven starts executing plugins against projects, Maven first has to 
construct the build plan.

The build plan needs to take into account the inter-project dependencies, so 
that the projects can be built in the correct sequence.

So if A -> B -> C, Maven needs to ensure that C is built before A. This is the 
case irrespective of whether B is part of the reactor or not... because if C is 
part of the reactor, then A should be using the artifacts of C that were built 
from the reactor.


So when you have a plugin execution bound to the lifecycle, and it says "I will 
need the dependencies" then Maven says: oh look, there will be a plugin that 
needs to resolve dependencies, therefore I need to compute the dependency graph 
and resolve it in order to ensure that any side-effects of the dependency graph 
do no affect my planned build order.

So when you go "mvn initialize", Maven looks at the plugins, says only one 
plugin execution for this lifecycle, that doesn't need the dependencies 
resolved, fine the build plan is not going to be affected by inter-module 
dependencies, lets go

When you go "mvn install", Maven looks at the plugins, sees some plugins will 
be needing to resolve dependencies (e.g. compiler:compile, 
compiler:test-compile, surefire:test) and says... hmmm I had better take a look 
at the dependencies to see if they may impact my build plan... oh dear I cannot 
find this dependency anywhere... fail the build, because it's going to fail 
anyway and better to fail fast than waste the developers time.

I hope this explains Vincent's answer better for you.

-Stephen


On 5 March 2013 13:06, Macbeth, Andrew (US SSA) < 
andrew.macb...@baesystems.com> wrote:

> Anders,
> I included the debug output and pom.xml's in my previous message.
> Wondering if they didn't make it through to you. I've reattached them 
> to this message. If attachments aren't making it through, I'll resend 
> with contents pasted into the body of this message.
>
> A quick visual comparison of the debug output of initialize vs. 
> install indicates that the following does appear in initialize and 
> does not appear in install:
>
> [INFO] Installing ***/***/***/***/lib/jnetpcap.jar to 
> ***/***/.m2/repository/jnetpcap/jnetpcap/1.3.0/jnetpcap-1.3.0.jar
>
> Andy
>
> -----Original Message-----
> From: anders.g.ham...@gmail.com [mailto:anders.g.ham...@gmail.com] On 
> Behalf Of Anders Hammar
> Sent: Friday, March 01, 2013 2:18 AM
> To: Maven Users List
> Subject: Re: Initialize not running during Install?
>
> I doubt that this plugin is not executed when you perform a "mvn install"
> if it executes for "mvn initialize". If it would be the case, it's a 
> bug in Maven core.
>
> If you're using Maven 3, the console output will very clearly state 
> the plugins being executed. Could you execute "mvn install" and ensure 
> the plugin is not being executed. Compare to the output of "mvn initialize".
>
> If you still think something is wrong, we need a test case to try to 
> reproduce.
>
> /Anders
>
>
> On Thu, Feb 28, 2013 at 3:47 PM, Macbeth, Andrew (US SSA) < 
> andrew.macb...@baesystems.com> wrote:
>
> >  I am attempting to configure maven-install-plugin:install-file in 
> > my pom.xml. I want to install a third-party jar into my local repo. 
> > I prefer to run this in the pom.xml instead of command line so that 
> > developers on the team are unaffected and do not have to manually 
> > perform the install. An extract from my pom.xml is below.
> > <install-file> is set to run during the initialize phase. When I 
> > execute "mvn initialize" the jar is successfully installed into my 
> > local repo. However, when I run "mvn install", it does not get 
> > installed
> (yes, I am clearing out the local repo between runs).
> > Very puzzling. I have attached the parent and module poms, and the 
> > debug outputs from mvn initialize and mvn install.****
> >
> > Help.****
> >
> > ** **
> >
> > <project>****
> >
> >                <build>****
> >
> >                               <plugins>****
> >
> >                                              <plugin>****
> >
> >
> > <groupId>org.apache.maven.plugins</groupId>****
> >
> >
> > <artifactId>maven-install-plugin</artifactId>****
> >
> >
> > <version>2.4</version>****
> >
> >
> > <executions>**
> > **
> >
> >
> > <execution>****
> >
> >
> > <id>install-jnetpcap</id>****
> >
> >
> > <phase>initialize</phase>****
> >
> >
> > <goals>****
> >
> >
> > <goal>install-file</goal>****
> >
> >
> > </goals>****
> >
> >
> > <configuration>****
> >
> >
> > <groupId>jnetpcap</groupId>****
> >
> >
> > <artifactId>jnetpcap</artifactId>****
> >
> >
> > <version>1.3.0</version>****
> >
> >
> > <packaging>jar</packaging>****
> >
> >
> >                <file>${project.basedir}/lib/jnetpcap.jar</file>****
> >
> >
> > <generatePom>true</generatePom>****
> >
> >
> > </configuration>****
> >
> >
> > </execution>****
> >
> >
> > </executions>*
> > ***
> >
> >                                              </plugin>****
> >
> >                               </plugins>****
> >
> >                </build>****
> >
> > </project>****
> >
> > ** **
> >
> > ** **
> >
> > Andrew J. Macbeth****
> >
> > BAE Systems, Inc., ES-AIT****
> >
> > 6 New England Executive Park, Burlington, MA****
> >
> > (781) 262-4742****
> >
> > ** **
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to