Re: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread Stephen Connolly
ok, so the end result is that if I want my plugin to work with 2.0.6+  
I need to parse the pom by hand in order to determine what is in the  
pluginManagement section and which bits are missing a version  
specification?


Sent from my iPod

On 3 Sep 2008, at 19:18, John Casey <[EMAIL PROTECTED]> wrote:

I wound up putting it in since the clone methods were a performance  
problem, and the solution was to do direct object construction and  
avoid all the tangled logic inside the inheritance assembler.


Now that we're [potentially] transitioning from concrete to dynamic  
and back in the build section of the POM, these clone methods have  
become quite a bit more prominent (they're called a lot more often).


Brian E. Fox wrote:

I thought it needed a full deep copy to preserve the model and we
decided to back away from that in this release? I remember discussing
it, but not the exact outcome.
-Original Message-
From: John Casey [mailto:[EMAIL PROTECTED] Sent: Wednesday,  
September 03, 2008 1:20 PM

To: Maven Developers List
Subject: Re: Question: How to get the original model before the
super-pom's pluginManagement is injected?
That's in the stuff I've been putting out in RCs, to be clear...
John Casey wrote:

FWIW, the reimplemented cloneModel(..) method (which in part causes

this

problem, because it clones too shallowly) should keep the

originalModel

instance from being polluted with resolved plugin information.

I *think* the integration test for MNG-3710 should cover this case,

but
I can't remember for sure. If not, we need a test case that we can  
use

to fix it.

Stephen Connolly wrote:

Grrr argh!

Ok, hmm I'll have a closer look at your code as you did not seem to

be

parsing the XML from my initial reading of the code

On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox <[EMAIL PROTECTED] 
>wrote:



You can't, this is why in the enforcer rule, I have to walk and
interpolate the entire tree. If I could get the model from maven
unmolested, I could cut out 99% of that code.

-Original Message-
From: Stephen Connolly [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2008 6:31 AM
To: Maven Developers List
Subject: Question: How to get the original model before the

super-pom's

pluginManagement is injected?

If I have the floowing pom.xml:


4.0.0

org.codehaus.mojo.versions-maven-plugin.it
parent
2.0
pom


 
   
 
   maven-checkstyle-plugin
   2.1
 
 
   org.apache.maven.plugins
   maven-javadoc-plugin
 
 
   org.apache.maven.plugins
   maven-compiler-plugin
   
 1.4
 1.4
   
 
   
 org.codehaus.mojo
 build-helper-maven-plugin
   
   
 
 
   
 org.apache.maven.plugins
 maven-clean-plugin
 2.1
   
 



How do I detect in a mojo that the pluginManagement section has a

entry

for
maven-compiler-plugin that *does not have the version  
specified*...


If I look at mavenProject.getPluginManagement().getPlugins() I'll

see
maven-compiler-plugin but with version set to 2.0.2 (from the  
super

pom)

If I look at

mavenProject. 
getModel().getBuild().getPluginManagement().getPlugins(),

same
thing (*But this should be ok as it's the interpolated model

anyway*)

If I look at

mavenProject. 
getOriginalModel().getBuild().getPluginManagement().getPlug

ins(),
same thing *isn't this supposed to be the original model... before
interpolation*

Just to check I'm not going mad I logged the output of
mavenProject.writeOriginalModel which gives:


4.0.0
org.codehaus.mojo.versions-maven-plugin.it
parent
pom
2.0

 
   
 
   maven-antrun-plugin
   1.1
 
 
   maven-assembly-plugin
   2.2-beta-2
 
 
   maven-clean-plugin
   2.2
 
 
   maven-compiler-plugin
   2.0.2
   
 1.4
 1.4
   
 
 
   maven-dependency-plugin
   2.0
 
 
   maven-deploy-plugin
   2.3
 
 
   maven-ear-plugin
   2.3.1
 
 
   maven-ejb-plugin
   2.1
 
 
   maven-install-plugin
   2.2
 
 
   maven-jar-plugin
   2.2
 
 
   maven-checkstyle-plugin
   2.1
 
 
   maven-javadoc-plugin
   2.4
 
 
   maven-plugin-plugin
   2.4.1
 
 
   maven-rar-plugin
   2.2
 
 
   maven-release-plugin
   2.0-beta-7
 
 
   maven-resources-plugin
   2.2
 
 
   maven-site-plugin
   2.0-beta-6
 
 
   maven-source-plugin
   2.0.4
 
 
   maven-surefire-plugin
   2.4.2
 
 
   maven-war-plugin
   2.1-alpha-1
 
 
   org.codehaus.mojo
   build-helper-maven-plugin
 
   
 
 
   
 maven-clean-plugin
 2.1
   
 



*oh look the super pom has been injected in before I can see it*

I have not checked, but I suspect that maven-enforcer-pl

Re: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread John Casey
I wound up putting it in since the clone methods were a performance 
problem, and the solution was to do direct object construction and avoid 
all the tangled logic inside the inheritance assembler.


Now that we're [potentially] transitioning from concrete to dynamic and 
back in the build section of the POM, these clone methods have become 
quite a bit more prominent (they're called a lot more often).


Brian E. Fox wrote:

I thought it needed a full deep copy to preserve the model and we
decided to back away from that in this release? I remember discussing
it, but not the exact outcome.

-Original Message-
From: John Casey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 03, 2008 1:20 PM

To: Maven Developers List
Subject: Re: Question: How to get the original model before the
super-pom's pluginManagement is injected?

That's in the stuff I've been putting out in RCs, to be clear...

John Casey wrote:

FWIW, the reimplemented cloneModel(..) method (which in part causes
this 

problem, because it clones too shallowly) should keep the
originalModel 

instance from being polluted with resolved plugin information.

I *think* the integration test for MNG-3710 should cover this case,
but 

I can't remember for sure. If not, we need a test case that we can use



to fix it.

Stephen Connolly wrote:

Grrr argh!

Ok, hmm I'll have a closer look at your code as you did not seem to

be

parsing the XML from my initial reading of the code

On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox 
<[EMAIL PROTECTED]>wrote:



You can't, this is why in the enforcer rule, I have to walk and
interpolate the entire tree. If I could get the model from maven
unmolested, I could cut out 99% of that code.

-Original Message-
From: Stephen Connolly [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2008 6:31 AM
To: Maven Developers List
Subject: Question: How to get the original model before the

super-pom's

pluginManagement is injected?

If I have the floowing pom.xml:


 4.0.0

 org.codehaus.mojo.versions-maven-plugin.it
 parent
 2.0
 pom

 
  

  
maven-checkstyle-plugin
2.1
  
  
org.apache.maven.plugins
maven-javadoc-plugin
  
  
org.apache.maven.plugins
maven-compiler-plugin

  1.4
  1.4

  

  org.codehaus.mojo
  build-helper-maven-plugin


  
  

  org.apache.maven.plugins
  maven-clean-plugin
  2.1

  
 


How do I detect in a mojo that the pluginManagement section has a

entry

for
maven-compiler-plugin that *does not have the version specified*...

If I look at mavenProject.getPluginManagement().getPlugins() I'll

see

maven-compiler-plugin but with version set to 2.0.2 (from the super

pom)

If I look at


mavenProject.getModel().getBuild().getPluginManagement().getPlugins(),

same
thing (*But this should be ok as it's the interpolated model

anyway*)

If I look at


mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug

ins(),
same thing *isn't this supposed to be the original model... before
interpolation*

Just to check I'm not going mad I logged the output of
mavenProject.writeOriginalModel which gives:


 4.0.0
 org.codehaus.mojo.versions-maven-plugin.it
 parent
 pom
 2.0
 
  

  
maven-antrun-plugin
1.1
  
  
maven-assembly-plugin
2.2-beta-2
  
  
maven-clean-plugin
2.2
  
  
maven-compiler-plugin
2.0.2

  1.4
  1.4

  
  
maven-dependency-plugin
2.0
  
  
maven-deploy-plugin
2.3
  
  
maven-ear-plugin
2.3.1
  
  
maven-ejb-plugin
2.1
  
  
maven-install-plugin
2.2
  
  
maven-jar-plugin
2.2
  
  
maven-checkstyle-plugin
2.1
  
  
maven-javadoc-plugin
2.4
  
  
maven-plugin-plugin
2.4.1
  
  
maven-rar-plugin
2.2
  
  
maven-release-plugin
2.0-beta-7
  
  
maven-resources-plugin
2.2
  
  
maven-site-plugin
2.0-beta-6
  
  
maven-source-plugin
2.0.4
  
  
maven-surefire-plugin
2.4.2
  
  
maven-war-plugin
2.1-alpha-1
  
  
org.codehaus.mojo
build-helper-maven-plugin
  

  
  

  maven-clean-plugin
  2.1

  
 


*oh look the super pom has been injected in before I can see it*

I have not checked, but I suspect that maven-enforcer-plugin will

have

the
same issue with Maven 2.0.9+ (given that I've pilfered a lot of the
logic
for missing versions from there)

I really don't want to have to write my ow

RE: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread Brian E. Fox
I thought it needed a full deep copy to preserve the model and we
decided to back away from that in this release? I remember discussing
it, but not the exact outcome.

-Original Message-
From: John Casey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 03, 2008 1:20 PM
To: Maven Developers List
Subject: Re: Question: How to get the original model before the
super-pom's pluginManagement is injected?

That's in the stuff I've been putting out in RCs, to be clear...

John Casey wrote:
> FWIW, the reimplemented cloneModel(..) method (which in part causes
this 
> problem, because it clones too shallowly) should keep the
originalModel 
> instance from being polluted with resolved plugin information.
> 
> I *think* the integration test for MNG-3710 should cover this case,
but 
> I can't remember for sure. If not, we need a test case that we can use

> to fix it.
> 
> Stephen Connolly wrote:
>> Grrr argh!
>>
>> Ok, hmm I'll have a closer look at your code as you did not seem to
be
>> parsing the XML from my initial reading of the code
>>
>> On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox 
>> <[EMAIL PROTECTED]>wrote:
>>
>>> You can't, this is why in the enforcer rule, I have to walk and
>>> interpolate the entire tree. If I could get the model from maven
>>> unmolested, I could cut out 99% of that code.
>>>
>>> -Original Message-----
>>> From: Stephen Connolly [mailto:[EMAIL PROTECTED]
>>> Sent: Wednesday, September 03, 2008 6:31 AM
>>> To: Maven Developers List
>>> Subject: Question: How to get the original model before the
super-pom's
>>> pluginManagement is injected?
>>>
>>> If I have the floowing pom.xml:
>>>
>>> 
>>>  4.0.0
>>>
>>>  org.codehaus.mojo.versions-maven-plugin.it
>>>  parent
>>>  2.0
>>>  pom
>>>
>>>  
>>>   
>>> 
>>>   
>>> maven-checkstyle-plugin
>>> 2.1
>>>   
>>>   
>>> org.apache.maven.plugins
>>> maven-javadoc-plugin
>>>   
>>>   
>>> org.apache.maven.plugins
>>> maven-compiler-plugin
>>> 
>>>   1.4
>>>   1.4
>>> 
>>>   
>>> 
>>>   org.codehaus.mojo
>>>   build-helper-maven-plugin
>>> 
>>> 
>>>   
>>>   
>>> 
>>>   org.apache.maven.plugins
>>>   maven-clean-plugin
>>>   2.1
>>> 
>>>   
>>>  
>>> 
>>>
>>> How do I detect in a mojo that the pluginManagement section has a
entry
>>> for
>>> maven-compiler-plugin that *does not have the version specified*...
>>>
>>> If I look at mavenProject.getPluginManagement().getPlugins() I'll
see
>>> maven-compiler-plugin but with version set to 2.0.2 (from the super
pom)
>>>
>>> If I look at
>>>
mavenProject.getModel().getBuild().getPluginManagement().getPlugins(),
>>> same
>>> thing (*But this should be ok as it's the interpolated model
anyway*)
>>>
>>> If I look at
>>>
mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug
>>> ins(),
>>> same thing *isn't this supposed to be the original model... before
>>> interpolation*
>>>
>>> Just to check I'm not going mad I logged the output of
>>> mavenProject.writeOriginalModel which gives:
>>>
>>> 
>>>  4.0.0
>>>  org.codehaus.mojo.versions-maven-plugin.it
>>>  parent
>>>  pom
>>>  2.0
>>>  
>>>   
>>> 
>>>   
>>> maven-antrun-plugin
>>> 1.1
>>>   
>>>   
>>> maven-assembly-plugin
>>> 2.2-beta-2
>>>   
>>>   
>>> maven-clean-plugin
>>> 2.2
>>>   
>>>   
>>> maven-compiler-plugin
>>> 2.0.2
>>> 
>>>   1.4
>>>   1.4
>>> 
>>>   
>>>   
>>> maven-dependency-plugin
>>> 2.0
>>>   
>>>   
>>> maven-deploy-plugin
>>> 2.3
>>>   
>>>   
>>> maven-ear-plugin
>>> 2.3.1
>>>  

Re: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread John Casey

That's in the stuff I've been putting out in RCs, to be clear...

John Casey wrote:
FWIW, the reimplemented cloneModel(..) method (which in part causes this 
problem, because it clones too shallowly) should keep the originalModel 
instance from being polluted with resolved plugin information.


I *think* the integration test for MNG-3710 should cover this case, but 
I can't remember for sure. If not, we need a test case that we can use 
to fix it.


Stephen Connolly wrote:

Grrr argh!

Ok, hmm I'll have a closer look at your code as you did not seem to be
parsing the XML from my initial reading of the code

On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox 
<[EMAIL PROTECTED]>wrote:



You can't, this is why in the enforcer rule, I have to walk and
interpolate the entire tree. If I could get the model from maven
unmolested, I could cut out 99% of that code.

-Original Message-
From: Stephen Connolly [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2008 6:31 AM
To: Maven Developers List
Subject: Question: How to get the original model before the super-pom's
pluginManagement is injected?

If I have the floowing pom.xml:


 4.0.0

 org.codehaus.mojo.versions-maven-plugin.it
 parent
 2.0
 pom

 
  

  
maven-checkstyle-plugin
2.1
  
  
org.apache.maven.plugins
maven-javadoc-plugin
  
  
org.apache.maven.plugins
maven-compiler-plugin

  1.4
  1.4

  

  org.codehaus.mojo
  build-helper-maven-plugin


  
  

  org.apache.maven.plugins
  maven-clean-plugin
  2.1

  
 


How do I detect in a mojo that the pluginManagement section has a entry
for
maven-compiler-plugin that *does not have the version specified*...

If I look at mavenProject.getPluginManagement().getPlugins() I'll see
maven-compiler-plugin but with version set to 2.0.2 (from the super pom)

If I look at
mavenProject.getModel().getBuild().getPluginManagement().getPlugins(),
same
thing (*But this should be ok as it's the interpolated model anyway*)

If I look at
mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug
ins(),
same thing *isn't this supposed to be the original model... before
interpolation*

Just to check I'm not going mad I logged the output of
mavenProject.writeOriginalModel which gives:


 4.0.0
 org.codehaus.mojo.versions-maven-plugin.it
 parent
 pom
 2.0
 
  

  
maven-antrun-plugin
1.1
  
  
maven-assembly-plugin
2.2-beta-2
  
  
maven-clean-plugin
2.2
  
  
maven-compiler-plugin
2.0.2

  1.4
  1.4

  
  
maven-dependency-plugin
2.0
  
  
maven-deploy-plugin
2.3
  
  
maven-ear-plugin
2.3.1
  
  
maven-ejb-plugin
2.1
  
  
maven-install-plugin
2.2
  
  
maven-jar-plugin
2.2
  
  
maven-checkstyle-plugin
2.1
  
  
maven-javadoc-plugin
2.4
  
  
maven-plugin-plugin
2.4.1
  
  
maven-rar-plugin
2.2
  
  
maven-release-plugin
2.0-beta-7
  
  
maven-resources-plugin
2.2
  
  
maven-site-plugin
2.0-beta-6
  
  
maven-source-plugin
2.0.4
  
  
maven-surefire-plugin
2.4.2
  
  
maven-war-plugin
2.1-alpha-1
  
  
org.codehaus.mojo
build-helper-maven-plugin
  

  
  

  maven-clean-plugin
  2.1

  
 


*oh look the super pom has been injected in before I can see it*

I have not checked, but I suspect that maven-enforcer-plugin will have
the
same issue with Maven 2.0.9+ (given that I've pilfered a lot of the
logic
for missing versions from there)

I really don't want to have to write my own ModelXpp3Reader, or have to
bury
in plugin code logic to find the pom.xml and read it in directly...

So... any thoughts?

-Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








--
John Casey
Developer, PMC Member - Apache Maven (http://maven.apache.org)
Blog: http://www.ejlife.net/blogs/buildchimp/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread John Casey
FWIW, the reimplemented cloneModel(..) method (which in part causes this 
problem, because it clones too shallowly) should keep the originalModel 
instance from being polluted with resolved plugin information.


I *think* the integration test for MNG-3710 should cover this case, but 
I can't remember for sure. If not, we need a test case that we can use 
to fix it.


Stephen Connolly wrote:

Grrr argh!

Ok, hmm I'll have a closer look at your code as you did not seem to be
parsing the XML from my initial reading of the code

On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox <[EMAIL PROTECTED]>wrote:


You can't, this is why in the enforcer rule, I have to walk and
interpolate the entire tree. If I could get the model from maven
unmolested, I could cut out 99% of that code.

-Original Message-
From: Stephen Connolly [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2008 6:31 AM
To: Maven Developers List
Subject: Question: How to get the original model before the super-pom's
pluginManagement is injected?

If I have the floowing pom.xml:


 4.0.0

 org.codehaus.mojo.versions-maven-plugin.it
 parent
 2.0
 pom

 
  

  
maven-checkstyle-plugin
2.1
  
  
org.apache.maven.plugins
maven-javadoc-plugin
  
  
org.apache.maven.plugins
maven-compiler-plugin

  1.4
  1.4

  

  org.codehaus.mojo
  build-helper-maven-plugin


  
  

  org.apache.maven.plugins
  maven-clean-plugin
  2.1

  
 


How do I detect in a mojo that the pluginManagement section has a entry
for
maven-compiler-plugin that *does not have the version specified*...

If I look at mavenProject.getPluginManagement().getPlugins() I'll see
maven-compiler-plugin but with version set to 2.0.2 (from the super pom)

If I look at
mavenProject.getModel().getBuild().getPluginManagement().getPlugins(),
same
thing (*But this should be ok as it's the interpolated model anyway*)

If I look at
mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug
ins(),
same thing *isn't this supposed to be the original model... before
interpolation*

Just to check I'm not going mad I logged the output of
mavenProject.writeOriginalModel which gives:


 4.0.0
 org.codehaus.mojo.versions-maven-plugin.it
 parent
 pom
 2.0
 
  

  
maven-antrun-plugin
1.1
  
  
maven-assembly-plugin
2.2-beta-2
  
  
maven-clean-plugin
2.2
  
  
maven-compiler-plugin
2.0.2

  1.4
  1.4

  
  
maven-dependency-plugin
2.0
  
  
maven-deploy-plugin
2.3
  
  
maven-ear-plugin
2.3.1
  
  
maven-ejb-plugin
2.1
  
  
maven-install-plugin
2.2
  
  
maven-jar-plugin
2.2
  
  
maven-checkstyle-plugin
2.1
  
  
maven-javadoc-plugin
2.4
  
  
maven-plugin-plugin
2.4.1
  
  
maven-rar-plugin
2.2
  
  
maven-release-plugin
2.0-beta-7
  
  
maven-resources-plugin
2.2
  
  
maven-site-plugin
2.0-beta-6
  
  
maven-source-plugin
2.0.4
  
  
maven-surefire-plugin
2.4.2
  
  
maven-war-plugin
2.1-alpha-1
  
  
org.codehaus.mojo
build-helper-maven-plugin
  

  
  

  maven-clean-plugin
  2.1

  
 


*oh look the super pom has been injected in before I can see it*

I have not checked, but I suspect that maven-enforcer-plugin will have
the
same issue with Maven 2.0.9+ (given that I've pilfered a lot of the
logic
for missing versions from there)

I really don't want to have to write my own ModelXpp3Reader, or have to
bury
in plugin code logic to find the pom.xml and read it in directly...

So... any thoughts?

-Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--
John Casey
Developer, PMC Member - Apache Maven (http://maven.apache.org)
Blog: http://www.ejlife.net/blogs/buildchimp/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread Stephen Connolly
Grrr argh!

Ok, hmm I'll have a closer look at your code as you did not seem to be
parsing the XML from my initial reading of the code

On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox <[EMAIL PROTECTED]>wrote:

> You can't, this is why in the enforcer rule, I have to walk and
> interpolate the entire tree. If I could get the model from maven
> unmolested, I could cut out 99% of that code.
>
> -Original Message-
> From: Stephen Connolly [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 03, 2008 6:31 AM
> To: Maven Developers List
> Subject: Question: How to get the original model before the super-pom's
> pluginManagement is injected?
>
> If I have the floowing pom.xml:
>
> 
>  4.0.0
>
>  org.codehaus.mojo.versions-maven-plugin.it
>  parent
>  2.0
>  pom
>
>  
>   
> 
>   
> maven-checkstyle-plugin
> 2.1
>   
>   
> org.apache.maven.plugins
> maven-javadoc-plugin
>   
>   
> org.apache.maven.plugins
> maven-compiler-plugin
> 
>   1.4
>   1.4
> 
>   
> 
>   org.codehaus.mojo
>   build-helper-maven-plugin
> 
> 
>   
>   
> 
>   org.apache.maven.plugins
>   maven-clean-plugin
>   2.1
> 
>   
>  
> 
>
> How do I detect in a mojo that the pluginManagement section has a entry
> for
> maven-compiler-plugin that *does not have the version specified*...
>
> If I look at mavenProject.getPluginManagement().getPlugins() I'll see
> maven-compiler-plugin but with version set to 2.0.2 (from the super pom)
>
> If I look at
> mavenProject.getModel().getBuild().getPluginManagement().getPlugins(),
> same
> thing (*But this should be ok as it's the interpolated model anyway*)
>
> If I look at
> mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug
> ins(),
> same thing *isn't this supposed to be the original model... before
> interpolation*
>
> Just to check I'm not going mad I logged the output of
> mavenProject.writeOriginalModel which gives:
>
> 
>  4.0.0
>  org.codehaus.mojo.versions-maven-plugin.it
>  parent
>  pom
>  2.0
>  
>   
> 
>   
> maven-antrun-plugin
> 1.1
>   
>   
> maven-assembly-plugin
> 2.2-beta-2
>   
>   
> maven-clean-plugin
> 2.2
>   
>   
> maven-compiler-plugin
> 2.0.2
> 
>   1.4
>   1.4
> 
>   
>   
> maven-dependency-plugin
> 2.0
>   
>   
> maven-deploy-plugin
> 2.3
>   
>   
> maven-ear-plugin
> 2.3.1
>   
>   
> maven-ejb-plugin
> 2.1
>   
>   
> maven-install-plugin
> 2.2
>   
>   
> maven-jar-plugin
> 2.2
>   
>   
> maven-checkstyle-plugin
> 2.1
>   
>   
> maven-javadoc-plugin
> 2.4
>   
>   
> maven-plugin-plugin
> 2.4.1
>   
>   
> maven-rar-plugin
> 2.2
>   
>   
> maven-release-plugin
> 2.0-beta-7
>   
>   
> maven-resources-plugin
> 2.2
>   
>   
> maven-site-plugin
> 2.0-beta-6
>   
>   
> maven-source-plugin
> 2.0.4
>   
>   
> maven-surefire-plugin
> 2.4.2
>   
>   
> maven-war-plugin
> 2.1-alpha-1
>   
>   
> org.codehaus.mojo
> build-helper-maven-plugin
>   
> 
>   
>   
> 
>   maven-clean-plugin
>   2.1
> 
>   
>  
> 
>
> *oh look the super pom has been injected in before I can see it*
>
> I have not checked, but I suspect that maven-enforcer-plugin will have
> the
> same issue with Maven 2.0.9+ (given that I've pilfered a lot of the
> logic
> for missing versions from there)
>
> I really don't want to have to write my own ModelXpp3Reader, or have to
> bury
> in plugin code logic to find the pom.xml and read it in directly...
>
> So... any thoughts?
>
> -Stephen
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


RE: Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread Brian E. Fox
You can't, this is why in the enforcer rule, I have to walk and
interpolate the entire tree. If I could get the model from maven
unmolested, I could cut out 99% of that code. 

-Original Message-
From: Stephen Connolly [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 03, 2008 6:31 AM
To: Maven Developers List
Subject: Question: How to get the original model before the super-pom's
pluginManagement is injected?

If I have the floowing pom.xml:


 4.0.0

 org.codehaus.mojo.versions-maven-plugin.it
 parent
 2.0
 pom

 
   
 
   
 maven-checkstyle-plugin
 2.1
   
   
 org.apache.maven.plugins
 maven-javadoc-plugin
   
   
 org.apache.maven.plugins
 maven-compiler-plugin
 
   1.4
   1.4
 
   
 
   org.codehaus.mojo
   build-helper-maven-plugin
 
 
   
   
 
   org.apache.maven.plugins
   maven-clean-plugin
   2.1
 
   
 


How do I detect in a mojo that the pluginManagement section has a entry
for
maven-compiler-plugin that *does not have the version specified*...

If I look at mavenProject.getPluginManagement().getPlugins() I'll see
maven-compiler-plugin but with version set to 2.0.2 (from the super pom)

If I look at
mavenProject.getModel().getBuild().getPluginManagement().getPlugins(),
same
thing (*But this should be ok as it's the interpolated model anyway*)

If I look at
mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug
ins(),
same thing *isn't this supposed to be the original model... before
interpolation*

Just to check I'm not going mad I logged the output of
mavenProject.writeOriginalModel which gives:


 4.0.0
 org.codehaus.mojo.versions-maven-plugin.it
 parent
 pom
 2.0
 
   
 
   
 maven-antrun-plugin
 1.1
   
   
 maven-assembly-plugin
 2.2-beta-2
   
   
 maven-clean-plugin
 2.2
   
   
 maven-compiler-plugin
 2.0.2
 
   1.4
   1.4
 
   
   
 maven-dependency-plugin
 2.0
   
   
 maven-deploy-plugin
 2.3
   
   
 maven-ear-plugin
 2.3.1
   
   
 maven-ejb-plugin
 2.1
   
   
 maven-install-plugin
 2.2
   
   
 maven-jar-plugin
 2.2
   
   
 maven-checkstyle-plugin
 2.1
   
   
 maven-javadoc-plugin
 2.4
   
   
 maven-plugin-plugin
 2.4.1
   
   
 maven-rar-plugin
 2.2
   
   
 maven-release-plugin
 2.0-beta-7
   
   
 maven-resources-plugin
 2.2
   
   
 maven-site-plugin
 2.0-beta-6
   
   
 maven-source-plugin
 2.0.4
   
   
 maven-surefire-plugin
 2.4.2
   
   
 maven-war-plugin
 2.1-alpha-1
   
   
 org.codehaus.mojo
 build-helper-maven-plugin
   
 
   
   
 
   maven-clean-plugin
   2.1
 
   
 


*oh look the super pom has been injected in before I can see it*

I have not checked, but I suspect that maven-enforcer-plugin will have
the
same issue with Maven 2.0.9+ (given that I've pilfered a lot of the
logic
for missing versions from there)

I really don't want to have to write my own ModelXpp3Reader, or have to
bury
in plugin code logic to find the pom.xml and read it in directly...

So... any thoughts?

-Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Question: How to get the original model before the super-pom's pluginManagement is injected?

2008-09-03 Thread Stephen Connolly
If I have the floowing pom.xml:


 4.0.0

 org.codehaus.mojo.versions-maven-plugin.it
 parent
 2.0
 pom

 
   
 
   
 maven-checkstyle-plugin
 2.1
   
   
 org.apache.maven.plugins
 maven-javadoc-plugin
   
   
 org.apache.maven.plugins
 maven-compiler-plugin
 
   1.4
   1.4
 
   
 
   org.codehaus.mojo
   build-helper-maven-plugin
 
 
   
   
 
   org.apache.maven.plugins
   maven-clean-plugin
   2.1
 
   
 


How do I detect in a mojo that the pluginManagement section has a entry for
maven-compiler-plugin that *does not have the version specified*...

If I look at mavenProject.getPluginManagement().getPlugins() I'll see
maven-compiler-plugin but with version set to 2.0.2 (from the super pom)

If I look at
mavenProject.getModel().getBuild().getPluginManagement().getPlugins(), same
thing (*But this should be ok as it's the interpolated model anyway*)

If I look at
mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlugins(),
same thing *isn't this supposed to be the original model... before
interpolation*

Just to check I'm not going mad I logged the output of
mavenProject.writeOriginalModel which gives:


 4.0.0
 org.codehaus.mojo.versions-maven-plugin.it
 parent
 pom
 2.0
 
   
 
   
 maven-antrun-plugin
 1.1
   
   
 maven-assembly-plugin
 2.2-beta-2
   
   
 maven-clean-plugin
 2.2
   
   
 maven-compiler-plugin
 2.0.2
 
   1.4
   1.4
 
   
   
 maven-dependency-plugin
 2.0
   
   
 maven-deploy-plugin
 2.3
   
   
 maven-ear-plugin
 2.3.1
   
   
 maven-ejb-plugin
 2.1
   
   
 maven-install-plugin
 2.2
   
   
 maven-jar-plugin
 2.2
   
   
 maven-checkstyle-plugin
 2.1
   
   
 maven-javadoc-plugin
 2.4
   
   
 maven-plugin-plugin
 2.4.1
   
   
 maven-rar-plugin
 2.2
   
   
 maven-release-plugin
 2.0-beta-7
   
   
 maven-resources-plugin
 2.2
   
   
 maven-site-plugin
 2.0-beta-6
   
   
 maven-source-plugin
 2.0.4
   
   
 maven-surefire-plugin
 2.4.2
   
   
 maven-war-plugin
 2.1-alpha-1
   
   
 org.codehaus.mojo
 build-helper-maven-plugin
   
 
   
   
 
   maven-clean-plugin
   2.1
 
   
 


*oh look the super pom has been injected in before I can see it*

I have not checked, but I suspect that maven-enforcer-plugin will have the
same issue with Maven 2.0.9+ (given that I've pilfered a lot of the logic
for missing versions from there)

I really don't want to have to write my own ModelXpp3Reader, or have to bury
in plugin code logic to find the pom.xml and read it in directly...

So... any thoughts?

-Stephen