I don't have Maven 3.02 or Java 7u25 handy but as you can see from my example 
execution below, Maven 3.0.5 and Java 7u45 works fine-that is, multiple 
executions of the plugin in the different lifecycle phases that I have 
executions declared in my project POM for all return the same value as the 
lifecycle phase).

 

C:\rpatrick\work\src\maven\lifecycle-phase\test-project>mvn  -version

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 07:51:

28-0600)

Maven home: c:\wls1213\oracle_common\modules\org.apache.maven_3.0.5

Java version: 1.7.0_45, vendor: Oracle Corporation

Java home: c:\java\jdk1.7.0\jre

Default locale: en_US, platform encoding: Cp1252

OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

 

C:\rpatrick\work\src\maven\lifecycle-phase\test-project>mvn install

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building lifecycle-phase-plugin-test 1.0-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (validate-phase) @ lifecycle-p

hase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is validate

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (compile-phase) @ lifecycle-ph

ase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is compile

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (process-classes-phase) @ life

cycle-phase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is process-classes

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (package-phase) @ lifecycle-ph

ase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is package

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (pre-integration-test-phase) @

lifecycle-phase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is pre-integration-test

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (post-integration-test-phase)

@ lifecycle-phase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is post-integration-test

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (verify-phase) @ lifecycle-pha

se-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is verify

[INFO]

[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ lifecycle-phas

e-plugin-test ---

[INFO] Installing C:\rpatrick\work\src\maven\lifecycle-phase\test-project\pom.xm

l to C:\Users\rpatrick\.m2\repository\test\lifecycle-phase-plugin-test\1.0-SNAPS

HOT\lifecycle-phase-plugin-test-1.0-SNAPSHOT.pom

[INFO]

[INFO] --- lifecycle-phases-plugin:1.0:phase-name (install-phase) @ lifecycle-ph

ase-plugin-test ---

[INFO] [phase-name] Maven lifecycle phase is install

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 0.880s

[INFO] Finished at: Mon Dec 30 16:55:29 CST 2013

[INFO] Final Memory: 14M/490M

[INFO] ------------------------------------------------------------------------

 

 

 

--

Robert Patrick <HYPERLINK 
"mailto:robert.patr...@oracle.com"robert.patr...@oracle.com>

VP, FMW Platform Architecture

Oracle Corporation                                Office: +1.940.725.0011

1148 Triple Crown Court                                 Fax: +1.940.725.0012

Bartonville, TX 76226, USA                    Mobile: +1.469.556.9450

 

HYPERLINK 
"http://www.amazon.com/Professional-Oracle-WebLogic-Server-Patrick/dp/0470484306/"Professional
 Oracle WebLogic Server

by Robert Patrick, Gregory Nyberg, and Philip Aston

with Josh Bregman and Paul Done

Book Home Page: HYPERLINK 
"http://www.wrox.com/WileyCDA/WroxTitle/Professional-Oracle-WebLogic-Server.productCd-0470484306.html"http://www.wrox.com/

Kindle Version: HYPERLINK 
"http://www.amazon.com/Professional-Oracle-WebLogic-Server-ebook/dp/B004HD69J2/"http://www.amazon.com/

 

 

From: Martin Gainty [mailto:mgai...@hotmail.com] 
Sent: Monday, December 30, 2013 3:41 PM
To: Maven Developers List; Robert Patrick
Subject: RE: Plugin phase awareness...

 

operational with JDK-1.6 but compiling and running with Oracle Java 
version=1.7.0.25 reproduces the bug

JDK: 1.6
mvn -version=3.0.2
maven-core:3.0
maven-plugin-annotations:3.2
test-project>mvn -e -X -o compile
[INFO] [phase-name]  Maven lifecycle phase is compile (correct)

JDK: 1.6
mvn -version =3.0.5
maven-core:3.0
maven-plugin-annotations:3.2
test-project>mvn -e -X -o compile
[INFO] [phase-name] Maven lifecycle phase is compile (correct)
 
JDK: 1.6
mvn -version=3.1.1
maven-core:3.0
maven-plugin-annotations:3.2
test-project>mvn -e -X -o compile
[INFO] [phase-name] Maven lifecycle phase is compile (correct)
 
----------------------------------JDK-1.7.0.25------------------------------
BASH>mvn -version
Apache Maven 3.0.2 (r1056850; 2011-01-08 19:58:10-0500)
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: jdk1.7.0_25/jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

mvn -version=3.0.2
maven-core:3.0
maven-plugin-annotations:3.2
 
test-project>mvn -e -X -o compile
[INFO] [phase-name] Maven lifecycle phase is validate
 
i wonder if Mr Gosling could possibly shed some light on this ?

Thanks Robert,
Martin-

  

> Date: Mon, 30 Dec 2013 08:07:46 -0800
> From: HYPERLINK "mailto:robert.patr...@oracle.com"robert.patr...@oracle.com
> To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> Subject: RE: Plugin phase awareness...
> 
> I had attached it to the last email but you can grab it here: 
> https://dl.dropboxusercontent.com/u/78116035/maven/lifecycle-phase.zip 
> 
> Hope this helps,
> Robert
> 
> --
> Robert Patrick <HYPERLINK 
> "mailto:robert.patr...@oracle.com"robert.patr...@oracle.com>
> VP, FMW Platform Architecture
> Oracle Corporation Office: +1.940.725.0011
> 1148 Triple Crown Court Fax: +1.940.725.0012
> Bartonville, TX 76226, USA Mobile: +1.469.556.9450
> 
> Professional Oracle WebLogic Server
> by Robert Patrick, Gregory Nyberg, and Philip Aston
> with Josh Bregman and Paul Done
> Book Home Page: http://www.wrox.com/
> Kindle Version: http://www.amazon.com/
> 
> 
> -----Original Message-----
> From: Martin Gainty [mailto:mgai...@hotmail.com] 
> Sent: Monday, December 30, 2013 10:02 AM
> To: Maven Developers List
> Subject: RE: Plugin phase awareness...
> 
> 
> Good Morning Patrick
> 
> could you upload plugin and test-harness somewhere (and let me have access).. 
> I would really like to get this working (and close out this bug)
> 
> Many Thanks for your help (and support)!
> Martin Gainty
> ______________________________________________ 
> 
> Inte förändra och störa denna överföring tack
> 
> 
> 
> 
> 
> Date: Mon, 30 Dec 2013 07:46:49 -0800
> From: HYPERLINK "mailto:robert.patr...@oracle.com"robert.patr...@oracle.com
> To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> Subject: RE: Plugin phase awareness...
> 
> Seems to work properly with Maven 3.0.5 anyway. See attached plugin and test 
> project.
> 
> 
> --
> Robert Patrick <HYPERLINK 
> "mailto:robert.patr...@oracle.com"robert.patr...@oracle.com> VP, FMW Platform 
> Architecture
> Oracle Corporation Office: +1.940.725.0011
> 1148 Triple Crown Court Fax: +1.940.725.0012
> Bartonville, TX 76226, USA Mobile: +1.469.556.9450
> 
> Professional Oracle WebLogic Server
> by Robert Patrick, Gregory Nyberg, and Philip Aston with Josh Bregman and 
> Paul Done Book Home Page: http://www.wrox.com/ Kindle Version: 
> http://www.amazon.com/
> 
> 
> -----Original Message-----
> From: Martin Gainty [mailto:mgai...@hotmail.com]
> Sent: Sunday, December 29, 2013 7:25 PM
> To: Maven Developers List
> Subject: RE: Plugin phase awareness...
> 
> 
> 
> 
> 
> > From: HYPERLINK "mailto:mgai...@hotmail.com"mgai...@hotmail.com
> > To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> > Subject: RE: Plugin phase awareness...
> > Date: Sun, 29 Dec 2013 17:46:29 -0500
> > 
> > 
> > 
> > 
> > 
> > 
> > > Date: Sun, 29 Dec 2013 15:13:12 +0000
> > > Subject: Re: Plugin phase awareness...
> > > From: HYPERLINK 
> > > "mailto:stephen.alan.conno...@gmail.com"stephen.alan.conno...@gmail.com
> > > To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> > > 
> > > Are you running the mojo directly in your testing by any chance?
> > > 
> > > Eg
> > > 
> > > mvn short-name:goal
> > MG>Correct I was testing in this fashion
> > 
> > > As opposed to
> > > 
> > > mvn phase
> > MG>Thanks Stephen I will try this out
> MG_12_29_2013>
> /**
> * @parameter expression="${mojoExecution}"
> */
> @Parameter(defaultValue = "${mojoExecution}") private 
> org.apache.maven.plugin.MojoExecution execution; //supposedly mojoExecution 
> injected here public org.apache.maven.plugin.MojoExecution getExecution() { 
> return execution; } //accessor for execution
> /**
> * @parameter expression="${mojoExecution.lifecyclePhase}"
> */
> @Parameter(defaultValue = "${mojoExecution.lifecyclePhase}")
> private String lifecyclePhase; //supposedly lifecyclePhase is injected here
> public org.apache.maven.model.Plugin plugin=new 
> org.apache.maven.model.Plugin();
> public String getLifecyclePhase() { //accessor for lifecyclePhase
> if(lifecyclePhase==null) {
> plugin.setGroupId("org.apache.maven.plugins");
> plugin.setArtifactId("maven-compiler-plugin");
> plugin.setVersion("3.1");
> String goal="compile";
> String executionId="executionId";
> System.out.println("CompilerMojoTestCase::getLifecyclePhase goal="+goal+" 
> executionId="+executionId);
> org.apache.maven.plugin.MojoExecution mojo=new 
> org.apache.maven.plugin.MojoExecution((org.apache.maven.model.Plugin)plugin, 
> goal, executionId );
> lifecyclePhase= mojo.getLifecyclePhase();
> }
> return lifecyclePhase;
> }
> 
> MG_12_29_2013>public void testCompilerBasic() throws Exception {
> System.out.println("CompilerMojoTestCase::testCompilerBasic LINE 143 
> getLifeyclePhase()= "+getLifecyclePhase());
> 
> MG_12_29_2013>mvn -e -X -o process-test-classes 1> errors.lst 
> MG_12_29_2013>CompilerMojoTestCase::getLifecyclePhase goal=compile 
> executionId=executionId
> MG_12_29_2013>CompilerMojoTestCase::testCompilerBasic LINE 143 
> getLifeyclePhase()= null
> 
> MG_12_29_2013>My thinking is that lifecyclePhase is somehow not being 
> injected..
> MG_12_29_2013>Ideas?
> > 
> > > Because if the former, then the phase is null as the execution was 
> > > not bound to a phase.
> > > 
> > > I have not used this specific property before, so cannot speak to 
> > > whether it works when bound to a phase, but if your test plugin 
> > > execution is not bound to a phase then you would not expect to see a 
> > > non null value
> > > 
> > > On Sunday, 29 December 2013, Martin Gainty wrote:
> > > 
> > > > Morning All-
> > > >
> > > >
> > > >
> > > > Even after downloading maven-core 3.1.1 source and re-compiling to 
> > > > new maven-core-3.1.1.jar distro and forcing maven-core-3.1.1 
> > > > dependency into maven-surefire-plugin
> > > >
> > > >
> > > > I could not get ${mojoExecution.lifecyclePhase} to display 
> > > > anything other than null
> > > >
> > > >
> > > > https://jira.codehaus.org/browse/MNG-5555
> > > >
> > > >
> > > >
> > > > Ideas?
> > > >
> > > > Martin --
> > > > ______________________________________________
> > > >
> > > >
> > > > Inte förändra och störa denna överföring
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > From: HYPERLINK "mailto:mgai...@hotmail.com"mgai...@hotmail.com 
> > > > <javascript:;>
> > > > To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org 
> > > > <javascript:;>
> > > > Subject: RE: Plugin phase awareness...
> > > > Date: Wed, 25 Dec 2013 22:40:07 -0500
> > > >
> > > >
> > > >
> > > >
> > > > Wasted an enormous amount of time chasing the exact location of 
> > > > .git file.. i guess its a good thing it was Christmas
> > > >
> > > > Thanks Jason!
> > > > Martin Gainty
> > > > ______________________________________________
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > From: HYPERLINK "mailto:jpye...@pdinc.us"jpye...@pdinc.us
> > > > > To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> > > > > Subject: RE: Plugin phase awareness...
> > > > > Date: Wed, 25 Dec 2013 10:52:34 -0500
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Martin Gainty
> > > > > > Sent: Wednesday, December 25, 2013 10:40
> > > > > >
> > > > > > bash>git clone
> > > > > > bash>https://github.com/apache/maven/blob/maven-3.1.1/maven-co
> > > > > > bash>re src
> > > > > > Cloning into 'src'...
> > > > > > fatal: repository
> > > > > > 'https://github.com/apache/maven/blob/maven-3.1.1/maven-core/'
> > > > > > not found
> > > > >
> > > > > It is not like subversion, git clone 
> > > > > https://github.com/apache/maven.git
> > > > >
> > > > > The git operation will have to happen from the root of the 
> > > > > repository,
> > > > and git
> > > > > hub does not auto redirect git clones to the proper url from the 
> > > > > repo
> > > > browser
> > > > > urls.
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Date: Tue, 24 Dec 2013 18:51:59 -0500
> > > > > > > From: HYPERLINK "mailto:i...@ifedorenko.com"i...@ifedorenko.com
> > > > > > > To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> > > > > > > Subject: Re: Plugin phase awareness...
> > > > > > >
> > > > > > >
> > > > > > https://github.com/apache/maven/blob/maven-3.1.1/maven-core/sr
> > > > > > c/main/j
> > > > > > > ava/org/apache/maven/plugin/MojoExecution.java#L160
> > > > > > >
> > > > > > >
> > > > > > > ... and, like I said, the example I pasted elsewhere in this 
> > > > > > > thread does work in maven 3.0.5 and 3.1.1.
> > > > > > >
> > > > > > > --
> > > > > > > Regards,
> > > > > > > Igor
> > > > > > >
> > > > > > > On 12/24/2013, 18:01, Martin Gainty wrote:
> > > > > > > > not found in 3.1.1
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > ${user.home}\org\apache\maven\maven-core\3.1.1\jar>javap
> > > > > > > > .\or g\apache\maven\plugin\MojoExecution | grep 
> > > > > > > > lifecyclePhase
> > > > > > > >
> > > > > > > >
> > > > > > > > Warning: Binary file
> > > > > > > > .\org\apache\maven\plugin\MojoExecution
> > > > > > > > contains org.apache.maven.plugin.MojoExecution
> > > > > > > >
> > > > > > > >
> > > > > > > > I have 3.1.1 fully operational but I cannt locate the
> > > > > > lifecyclePhase
> > > > > > > > in MojoExecution
> > > > > > > >
> > > > > > > > I *thought* 3.1.1 was latest...does anyone know where the
> > > > > > lifecyclePhase attribute is located?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Thanks!
> > > > > > > > Martin
> > > > > > > >
> > > > > > > > ______________________________________________
> > > > > > > > God jul till alla och
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >> From: HYPERLINK "mailto:mgai...@hotmail.com"mgai...@hotmail.com
> > > > > > > >> To: HYPERLINK "mailto:dev@maven.apache.org"dev@maven.apache.org
> > > > > > > >> Subject: RE: Plugin phase awareness...
> > > > > > > >> Date: Tue, 24 Dec 2013 08:01:01 -0500
> > > > > > > >>
> > > > > > > >> mvn version 3.0.2
> > > > > > > >>
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> public class CompilerMojo extends AbstractCompilerMojo
> > > > > > > >>
> > > > > > > >> {
> > > > > > > >>
> > > > > > > >> /**
> > > > > > > >> * @parameter expression="${mojoExecution}"
> > > > > > > >> */
> > > > > > > >> @Pa
> > > 
> > > 
> > > 
> > > --
> > > Sent from my phone
> > 
> 
> 
> --------------------------------------------------------------------- To 
> unsubscribe, e-mail: HYPERLINK 
> "mailto:dev-unsubscr...@maven.apache.org"dev-unsubscr...@maven.apache.org For 
> additional commands, e-mail: HYPERLINK 
> "mailto:dev-h...@maven.apache.org"dev-h...@maven.apache.org 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: HYPERLINK 
> "mailto:dev-unsubscr...@maven.apache.org"dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: HYPERLINK 
> "mailto:dev-h...@maven.apache.org"dev-h...@maven.apache.org
> 

Reply via email to