You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Stephen Connolly <st...@gmail.com> on 2009/03/16 18:26:47 UTC

MavenXpp3Reader

Hey!

So either my memory is wrong or i remember somebody saying it's a "bad
thing"(TM) to use MavenXpp3Reader from a plugin....

I know that 99% of the time one should use model builder directly, but I
have a use case where I just want the results before *any* interpolation
what so ever is performed...

Am I still doing a "bad thing" or is this the 1% i suspect it is?

-Stephen

Re: MavenXpp3Reader

Posted by Jason van Zyl <jv...@sonatype.com>.
On 16-Mar-09, at 5:06 PM, Stephen Connolly wrote:

> Yeah, I got that, but will it be interpolated...
>

No. The raw model.

> at present by using MXpp3 I can get the raw model.
>
> project.getOriginalModel() gives a kind-of interpolated without  
> property
> evaluation
>
> project.getModel() gives the final values.
>
> For 3.x will there be a route to all three or are we losing the middle
> ground?
>
> I know I have a need for interpolated pre-property substituion as  
> well as
> the final model... and I also have a need for the raw model...
>
> For example to differentiate between plugins inherited with versions
> specified in the pom, plugins inherited with versions coming from
> inheritance, etc.
>
> -Stephen
>
> 2009/3/16 Jason van Zyl <jv...@sonatype.com>
>
>>
>> On 16-Mar-09, at 12:47 PM, Stephen Connolly wrote:
>>
>> I have code which does what I need, so if enforcer is doing similar  
>> then
>>> I'm
>>> happy
>>>
>>> -Stephen
>>>
>>> BTW, how does this change in 3.x?
>>>
>>
>> When you ask for the model it won't be mutated.
>>
>>
>>
>>> 2009/3/16 Jason van Zyl <jv...@sonatype.com>
>>>
>>> Brian had to do this in the enforcer so there is code for 2.x there.
>>>>
>>>> In 3.x the model original model hierarchy is not mutated and  
>>>> stored along
>>>> with the project.
>>>>
>>>>
>>>> On 16-Mar-09, at 10:26 AM, Stephen Connolly wrote:
>>>>
>>>> Hey!
>>>>
>>>>>
>>>>> So either my memory is wrong or i remember somebody saying it's  
>>>>> a "bad
>>>>> thing"(TM) to use MavenXpp3Reader from a plugin....
>>>>>
>>>>> I know that 99% of the time one should use model builder  
>>>>> directly, but I
>>>>> have a use case where I just want the results before *any*  
>>>>> interpolation
>>>>> what so ever is performed...
>>>>>
>>>>> Am I still doing a "bad thing" or is this the 1% i suspect it is?
>>>>>
>>>>> -Stephen
>>>>>
>>>>>
>>>> Thanks,
>>>>
>>>> Jason
>>>>
>>>> ----------------------------------------------------------
>>>> Jason van Zyl
>>>> Founder,  Apache Maven
>>>> http://twitter.com/jvanzyl
>>>> ----------------------------------------------------------
>>>>
>>>> To do two things at once is to do neither.
>>>>
>>>> -—Publilius Syrus, Roman slave, first century B.C.
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>
>>>>
>>>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder,  Apache Maven
>> http://twitter.com/jvanzyl
>> ----------------------------------------------------------
>>
>> the course of true love never did run smooth ...
>>
>> -- Shakespeare
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

A language that doesn’t affect the way you think about programming is  
not worth knowing.

-— Alan Perlis


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: MavenXpp3Reader

Posted by Stephen Connolly <st...@gmail.com>.
Yeah, I got that, but will it be interpolated...

at present by using MXpp3 I can get the raw model.

project.getOriginalModel() gives a kind-of interpolated without property
evaluation

project.getModel() gives the final values.

For 3.x will there be a route to all three or are we losing the middle
ground?

I know I have a need for interpolated pre-property substituion as well as
the final model... and I also have a need for the raw model...

For example to differentiate between plugins inherited with versions
specified in the pom, plugins inherited with versions coming from
inheritance, etc.

-Stephen

2009/3/16 Jason van Zyl <jv...@sonatype.com>

>
> On 16-Mar-09, at 12:47 PM, Stephen Connolly wrote:
>
>  I have code which does what I need, so if enforcer is doing similar then
>> I'm
>> happy
>>
>> -Stephen
>>
>> BTW, how does this change in 3.x?
>>
>
> When you ask for the model it won't be mutated.
>
>
>
>> 2009/3/16 Jason van Zyl <jv...@sonatype.com>
>>
>>  Brian had to do this in the enforcer so there is code for 2.x there.
>>>
>>> In 3.x the model original model hierarchy is not mutated and stored along
>>> with the project.
>>>
>>>
>>> On 16-Mar-09, at 10:26 AM, Stephen Connolly wrote:
>>>
>>> Hey!
>>>
>>>>
>>>> So either my memory is wrong or i remember somebody saying it's a "bad
>>>> thing"(TM) to use MavenXpp3Reader from a plugin....
>>>>
>>>> I know that 99% of the time one should use model builder directly, but I
>>>> have a use case where I just want the results before *any* interpolation
>>>> what so ever is performed...
>>>>
>>>> Am I still doing a "bad thing" or is this the 1% i suspect it is?
>>>>
>>>> -Stephen
>>>>
>>>>
>>> Thanks,
>>>
>>> Jason
>>>
>>> ----------------------------------------------------------
>>> Jason van Zyl
>>> Founder,  Apache Maven
>>> http://twitter.com/jvanzyl
>>> ----------------------------------------------------------
>>>
>>> To do two things at once is to do neither.
>>>
>>> -—Publilius Syrus, Roman slave, first century B.C.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ----------------------------------------------------------
>
> the course of true love never did run smooth ...
>
>  -- Shakespeare
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: MavenXpp3Reader

Posted by Jason van Zyl <jv...@sonatype.com>.
On 16-Mar-09, at 12:47 PM, Stephen Connolly wrote:

> I have code which does what I need, so if enforcer is doing similar  
> then I'm
> happy
>
> -Stephen
>
> BTW, how does this change in 3.x?

When you ask for the model it won't be mutated.

>
> 2009/3/16 Jason van Zyl <jv...@sonatype.com>
>
>> Brian had to do this in the enforcer so there is code for 2.x there.
>>
>> In 3.x the model original model hierarchy is not mutated and stored  
>> along
>> with the project.
>>
>>
>> On 16-Mar-09, at 10:26 AM, Stephen Connolly wrote:
>>
>> Hey!
>>>
>>> So either my memory is wrong or i remember somebody saying it's a  
>>> "bad
>>> thing"(TM) to use MavenXpp3Reader from a plugin....
>>>
>>> I know that 99% of the time one should use model builder directly,  
>>> but I
>>> have a use case where I just want the results before *any*  
>>> interpolation
>>> what so ever is performed...
>>>
>>> Am I still doing a "bad thing" or is this the 1% i suspect it is?
>>>
>>> -Stephen
>>>
>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder,  Apache Maven
>> http://twitter.com/jvanzyl
>> ----------------------------------------------------------
>>
>> To do two things at once is to do neither.
>>
>> -—Publilius Syrus, Roman slave, first century B.C.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

the course of true love never did run smooth ...

  -- Shakespeare


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: MavenXpp3Reader

Posted by Stephen Connolly <st...@gmail.com>.
I have code which does what I need, so if enforcer is doing similar then I'm
happy

-Stephen

BTW, how does this change in 3.x?

2009/3/16 Jason van Zyl <jv...@sonatype.com>

> Brian had to do this in the enforcer so there is code for 2.x there.
>
> In 3.x the model original model hierarchy is not mutated and stored along
> with the project.
>
>
> On 16-Mar-09, at 10:26 AM, Stephen Connolly wrote:
>
>  Hey!
>>
>> So either my memory is wrong or i remember somebody saying it's a "bad
>> thing"(TM) to use MavenXpp3Reader from a plugin....
>>
>> I know that 99% of the time one should use model builder directly, but I
>> have a use case where I just want the results before *any* interpolation
>> what so ever is performed...
>>
>> Am I still doing a "bad thing" or is this the 1% i suspect it is?
>>
>> -Stephen
>>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ----------------------------------------------------------
>
> To do two things at once is to do neither.
>
>  -—Publilius Syrus, Roman slave, first century B.C.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: MavenXpp3Reader

Posted by Jason van Zyl <jv...@sonatype.com>.
Brian had to do this in the enforcer so there is code for 2.x there.

In 3.x the model original model hierarchy is not mutated and stored  
along with the project.

On 16-Mar-09, at 10:26 AM, Stephen Connolly wrote:

> Hey!
>
> So either my memory is wrong or i remember somebody saying it's a "bad
> thing"(TM) to use MavenXpp3Reader from a plugin....
>
> I know that 99% of the time one should use model builder directly,  
> but I
> have a use case where I just want the results before *any*  
> interpolation
> what so ever is performed...
>
> Am I still doing a "bad thing" or is this the 1% i suspect it is?
>
> -Stephen

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

To do two things at once is to do neither.

  -—Publilius Syrus, Roman slave, first century B.C.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: MavenXpp3Reader

Posted by Stephen Connolly <st...@gmail.com>.
Yeah, all I'm trying to grab is...

<plugin>
<version>______</version>
</plugin>

and

<dependency>
<version>_______</version>
</dependency>

I know I have to do a little digging to figure out the artifactId and the
groupId if they are defined by properties, but I need to know:
1. if there is a version specified
2. what the text specifying the version is (to see if it uses ${____})

I then go and relate this information back to the interpolated and original
models from project builder...

since project builder messes with both the original and the interpolated
models I have to go down to the raw source..... I was parsing the XML
directly with a pull parser... but I suspect that's far worse than using the
raw model from MavenXpp3Reader

;-)

-Stephen

2009/3/16 John Casey <jd...@commonjava.org>

> Unless someone else knows more about it than I do, I'd say you're probably
> right; it's in that 1%. :-)
>
> The problem with skipping the project builder is that assembly of project
> instances is really complex, and skipping any of these steps may result in
> project instances with apparent bugs that may not work correctly in the rest
> of the build.
>
> As long as the Model instance you read directly from XML isn't used except
> to grab some very limited information from the XML file (not, for instance,
> from something that may be interpolated within that file), you should be
> okay...
>
> -john
>
>
> Stephen Connolly wrote:
>
>> Hey!
>>
>> So either my memory is wrong or i remember somebody saying it's a "bad
>> thing"(TM) to use MavenXpp3Reader from a plugin....
>>
>> I know that 99% of the time one should use model builder directly, but I
>> have a use case where I just want the results before *any* interpolation
>> what so ever is performed...
>>
>> Am I still doing a "bad thing" or is this the 1% i suspect it is?
>>
>> -Stephen
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: MavenXpp3Reader

Posted by John Casey <jd...@commonjava.org>.
Unless someone else knows more about it than I do, I'd say you're 
probably right; it's in that 1%. :-)

The problem with skipping the project builder is that assembly of 
project instances is really complex, and skipping any of these steps may 
result in project instances with apparent bugs that may not work 
correctly in the rest of the build.

As long as the Model instance you read directly from XML isn't used 
except to grab some very limited information from the XML file (not, for 
instance, from something that may be interpolated within that file), you 
should be okay...

-john

Stephen Connolly wrote:
> Hey!
> 
> So either my memory is wrong or i remember somebody saying it's a "bad
> thing"(TM) to use MavenXpp3Reader from a plugin....
> 
> I know that 99% of the time one should use model builder directly, but I
> have a use case where I just want the results before *any* interpolation
> what so ever is performed...
> 
> Am I still doing a "bad thing" or is this the 1% i suspect it is?
> 
> -Stephen
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org