You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jason Pyeron <jp...@pdinc.us> on 2011/09/12 20:24:24 UTC

RE: [maven] Re: Preserving whitespace when configuring plugin?

> -----Original Message-----
> From: Laird Nelson [mailto:ljnelson@gmail.com] 
> Sent: Monday, September 12, 2011 14:11
> To: Maven Users List
> Subject: [maven] Re: Preserving whitespace when configuring plugin?
> 
> On Mon, Sep 12, 2011 at 1:46 PM, Laird Nelson 
> <lj...@gmail.com> wrote:
> 
> > Somewhat more alarmingly, it looks like leading and trailing 
> > whitespace is trimmed as well.  So:
> >
> > <someConfigurationElement>   Hello!   </someConfigurationElement>
> >
> > ...is trimmed and becomes simply:
> >
> > Hello!
> >
> > ...in my code (no leading or trailing space).
> >
> 
> I've filed http://jira.codehaus.org/browse/PLX-461 to track 
> this; it may very well be in the wrong place or the wrong project.

This might be related to the booleans issue I was having too.

http://jira.codehaus.org/browse/MNG-5166, it too was a result of stripping away
whitespace and tags enmass.
 
> 
> The problem shows up as well by simply running mvn 
> help:effective-pom, so no test case is needed.  Just put a 
> fragment like this in any plugin stanza:
> 
> <someConfigurationElement>   Hello!   </someConfigurationElement>
> 
> ...and then run mvn help:effective-pom, and you'll see:
> 
> <someConfigurationElement>Hello!</someConfigurationElement>
> 
> ...in the output.  This is true whether you use CDATA, 
> literal values, entities, or the xml:space="preserve" attribute.
> 
> Best,
> Laird
> 
> --
> http://about.me/lairdnelson
> 

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.


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


Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Laird Nelson <lj...@gmail.com>.
On Mon, Sep 12, 2011 at 2:24 PM, Jason Pyeron <jp...@pdinc.us> wrote:

> This might be related to the booleans issue I was having too.
>
> http://jira.codehaus.org/browse/MNG-5166, it too was a result of stripping
> away
> whitespace and tags en masse.
>

You can test for the presence of this particular bug by just doing mvn
help:effective-pom; you can see that leading, trailing and "only" whitespace
contents are removed from plugin configuration elements before, I think,
things even get sent off to the underlying configuration machinery.  This is
straight XML parser abuse, I think.

Best,
Laird

-- 
http://about.me/lairdnelson

Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Jason van Zyl <ja...@maven.org>.
On Sep 12, 2011, at 5:50 PM, Ansgar Konermann wrote:

> Am 12.09.2011 23:21, schrieb Jason van Zyl:
>> On Sep 12, 2011, at 4:13 PM, Ansgar Konermann wrote:
>> 
>>> Am 12.09.2011 22:11, schrieb Jason Pyeron:
>>>> I think that supporting the xml:space='preserve' would be best as it would be
>>>> backwards compatible. But there are other disfunctions in the same parsing logic
>>>> too.
>>> @Jason van Zyl: any chances to clean up these "other disfunctions"
>>> somewhen in the future, maybe under the hood of polyglot maven? What's
>>> the current status of polyglot maven actually? Does it make significant
>>> progress, can we hope to see a release anytime soon?
>>> 
>> This doesn't have anything to do with Polyglot Maven. It's the XML parser generator in Modello. 
> 
> Sure, but as it seems that the existing XML parser should keep certain
> bugs by intention, I'm thinking of alternative ways to get to a cleaner,
> more bug-free parser. I thought polyglot maven could be an option.
> 

I think the solution offered was a perfect one. The feature is activated by user acknowledgement, inclusion of xml:space=preserve, and everyone else is left to the standard behavior. That could be integrated pretty easily into the existing modello/xpp3 framework. I'd be happy to help anyone who wanted to take a pass at submitting a pull request.

> Sorry if that was not expressed so clearly.
> 

Polyglot Maven, as an independent project, is not something I'm working on anymore.  Nor the Maven Shell for that matter.

> Best
> 
> Ansgar
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Thanks,

Jason

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

A man enjoys his work when he understands the whole and when he
is responsible for the quality of the whole

 -- Christopher Alexander, A Pattern Language




Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 12.09.2011 23:21, schrieb Jason van Zyl:
> On Sep 12, 2011, at 4:13 PM, Ansgar Konermann wrote:
>
>> Am 12.09.2011 22:11, schrieb Jason Pyeron:
>>> I think that supporting the xml:space='preserve' would be best as it would be
>>> backwards compatible. But there are other disfunctions in the same parsing logic
>>> too.
>> @Jason van Zyl: any chances to clean up these "other disfunctions"
>> somewhen in the future, maybe under the hood of polyglot maven? What's
>> the current status of polyglot maven actually? Does it make significant
>> progress, can we hope to see a release anytime soon?
>>
> This doesn't have anything to do with Polyglot Maven. It's the XML parser generator in Modello. 

Sure, but as it seems that the existing XML parser should keep certain
bugs by intention, I'm thinking of alternative ways to get to a cleaner,
more bug-free parser. I thought polyglot maven could be an option.

Sorry if that was not expressed so clearly.

Best

Ansgar


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


Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Jason van Zyl <ja...@maven.org>.
On Sep 12, 2011, at 4:13 PM, Ansgar Konermann wrote:

> Am 12.09.2011 22:11, schrieb Jason Pyeron:
>> I think that supporting the xml:space='preserve' would be best as it would be
>> backwards compatible. But there are other disfunctions in the same parsing logic
>> too.
> @Jason van Zyl: any chances to clean up these "other disfunctions"
> somewhen in the future, maybe under the hood of polyglot maven? What's
> the current status of polyglot maven actually? Does it make significant
> progress, can we hope to see a release anytime soon?
> 

This doesn't have anything to do with Polyglot Maven. It's the XML parser generator in Modello. 

> Best regards
> 
> Ansgar
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Thanks,

Jason

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





Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 12.09.2011 22:11, schrieb Jason Pyeron:
> I think that supporting the xml:space='preserve' would be best as it would be
> backwards compatible. But there are other disfunctions in the same parsing logic
> too.
@Jason van Zyl: any chances to clean up these "other disfunctions"
somewhen in the future, maybe under the hood of polyglot maven? What's
the current status of polyglot maven actually? Does it make significant
progress, can we hope to see a release anytime soon?

Best regards

Ansgar

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


RE: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Laird Nelson [mailto:ljnelson@gmail.com] 
> Sent: Monday, September 12, 2011 15:31
> To: Maven Users List
> Subject: Re: [maven] Re: Preserving whitespace when 
> configuring plugin?
> 
> On Mon, Sep 12, 2011 at 3:19 PM, Jason van Zyl 
> <ja...@maven.org> wrote:
> 
> > I'm not [sure that] changing the way the trimming behaviour 
> works now 
> > would be the wisest thing to do after operating that way for so long
> >
> 
> I agree, and it's why I'm still a little dopey and confused 
> as to why this problem would need to be addressed in some 
> global fashion.  I'm looking for some kind of selective way 
> (don't care what it is) for whitespace to be preserved in 
> pom.xml configuration elements (only).  The 
> standards-compliant way to do it without even having to touch 
> CDATA is to honor the (hard-coded) xml:space="preserve" 
> attribute.  Since Modello never outputs this attribute, or 
> reads it, anywhere, it would seem like honoring this 
> attribute when it is present would be the simplest way to fix 
> this issue without affecting anything about backwards compatibility.
> 

I think that supporting the xml:space='preserve' would be best as it would be
backwards compatible. But there are other disfunctions in the same parsing logic
too.

-Jason

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 


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


Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Jason van Zyl <ja...@maven.org>.
On Sep 12, 2011, at 3:31 PM, Laird Nelson wrote:

> On Mon, Sep 12, 2011 at 3:19 PM, Jason van Zyl <ja...@maven.org> wrote:
> 
>> I'm not [sure that] changing the way the trimming behaviour works now would
>> be the wisest thing to do after operating that way for so long
>> 
> 
> I agree, and it's why I'm still a little dopey and confused as to why this
> problem would need to be addressed in some global fashion.  I'm looking for
> some kind of selective way (don't care what it is) for whitespace to be
> preserved in pom.xml configuration elements (only).  

Even that may cause problems, the behavior has been there so long you just have no way of telling.

> The standards-compliant
> way to do it without even having to touch CDATA is to honor the (hard-coded)
> xml:space="preserve" attribute.  Since Modello never outputs this attribute,
> or reads it, anywhere, it would seem like honoring this attribute when it is
> present would be the simplest way to fix this issue without affecting
> anything about backwards compatibility.

That would be a good way to do it.

> 
> Regarding my plugin, I have a workaround; thanks.
> 

Good good.

> Best,
> Laird
> 
> -- 
> http://about.me/lairdnelson

Thanks,

Jason

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

We all have problems. How we deal with them is a measure of our worth.

 -- Unknown




Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Laird Nelson <lj...@gmail.com>.
On Mon, Sep 12, 2011 at 3:19 PM, Jason van Zyl <ja...@maven.org> wrote:

> I'm not [sure that] changing the way the trimming behaviour works now would
> be the wisest thing to do after operating that way for so long
>

I agree, and it's why I'm still a little dopey and confused as to why this
problem would need to be addressed in some global fashion.  I'm looking for
some kind of selective way (don't care what it is) for whitespace to be
preserved in pom.xml configuration elements (only).  The standards-compliant
way to do it without even having to touch CDATA is to honor the (hard-coded)
xml:space="preserve" attribute.  Since Modello never outputs this attribute,
or reads it, anywhere, it would seem like honoring this attribute when it is
present would be the simplest way to fix this issue without affecting
anything about backwards compatibility.

Regarding my plugin, I have a workaround; thanks.

Best,
Laird

-- 
http://about.me/lairdnelson

Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Jason van Zyl <ja...@maven.org>.
Your best option of to use a configuration parameter that references an XML configuration and use decentxml[1] to read in that XML to preserve all whitespace and formatting. 

I'm not changing the way the trimming behaviour works now would be the wisest thing to do after operating that way for so long, but I would agree that it should respect CDATA blocks if it's not. At any your first option using decentxml will get you to a solution that works faster.

[1]: http://code.google.com/p/decentxml/

On Sep 12, 2011, at 3:09 PM, Laird Nelson wrote:

> On Mon, Sep 12, 2011 at 2:57 PM, Laird Nelson <lj...@gmail.com> wrote:
> 
>> Please vote for http://jira.codehaus.org/browse/MODELLO-256 and for
>> http://jira.codehaus.org/browse/PLX-461.
>> 
> 
> It looks to me like the Modello project, which generates the readers that
> are capable of parsing a pom.xml, is at least capable of seeing if a field
> can be trimmed.  Unfortunately I can't tell how this determination is made.
> There is a class in Modello somewhere called XmlFieldMetaData that has an
> isTrim() method, and the reader that is generated does seem to obey this
> directive.  Now how you could possibly influence the pom.xml reader to obey
> this directive when it's parsing the pom.xml for certain elements is
> entirely beyond me.  Help?
> 
> Best,
> Laird
> 
> -- 
> http://about.me/lairdnelson

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.




Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Laird Nelson <lj...@gmail.com>.
On Mon, Sep 12, 2011 at 2:57 PM, Laird Nelson <lj...@gmail.com> wrote:

> Please vote for http://jira.codehaus.org/browse/MODELLO-256 and for
> http://jira.codehaus.org/browse/PLX-461.
>

It looks to me like the Modello project, which generates the readers that
are capable of parsing a pom.xml, is at least capable of seeing if a field
can be trimmed.  Unfortunately I can't tell how this determination is made.
There is a class in Modello somewhere called XmlFieldMetaData that has an
isTrim() method, and the reader that is generated does seem to obey this
directive.  Now how you could possibly influence the pom.xml reader to obey
this directive when it's parsing the pom.xml for certain elements is
entirely beyond me.  Help?

Best,
Laird

-- 
http://about.me/lairdnelson

Re: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Laird Nelson <lj...@gmail.com>.
On Mon, Sep 12, 2011 at 2:38 PM, Ansgar Konermann <
ansgar.konermann@googlemail.com> wrote:

> This hit me too when I was trying to configure the commit message prefix of
> the release plugin to contain whitespace at the end, so it looks like
> "[some
> prefix] prepare for next development iteration". Best I could achieve was
> "[some prefix]_prepare for next development iteration", which is a bit ugly
> in my eyes.
>
> Would love to see it fixed.


Please vote for http://jira.codehaus.org/browse/MODELLO-256 and for
http://jira.codehaus.org/browse/PLX-461.

Best,
Laird

-- 
http://about.me/lairdnelson

RE: [maven] Re: Preserving whitespace when configuring plugin?

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 12.09.2011 20:18 schrieb "Jason Pyeron" <jp...@pdinc.us>:
>
>
> > -----Original Message-----
> > From: Laird Nelson [mailto:ljnelson@gmail.com]
> > Sent: Monday, September 12, 2011 14:11
> > To: Maven Users List
> > Subject: [maven] Re: Preserving whitespace when configuring plugin?
> >
> > On Mon, Sep 12, 2011 at 1:46 PM, Laird Nelson
> > <lj...@gmail.com> wrote:
> >
> > > Somewhat more alarmingly, it looks like leading and trailing
> > > whitespace is trimmed as well.  So:
> > >
> > > <someConfigurationElement>   Hello!   </someConfigurationElement>
> > >
> > > ...is trimmed and becomes simply:
> > >
> > > Hello!
> > >
> > > ...in my code (no leading or trailing space).
> > >
> >
> > I've filed http://jira.codehaus.org/browse/PLX-461 to track
> > this; it may very well be in the wrong place or the wrong project.
>
> This might be related to the booleans issue I was having too.
>
> http://jira.codehaus.org/browse/MNG-5166, it too was a result of stripping
away
> whitespace and tags enmass.
>

This hit me too when I was trying to configure the commit message prefix of
the release plugin to contain whitespace at the end, so it looks like "[some
prefix] prepare for next development iteration". Best I could achieve was
"[some prefix]_prepare for next development iteration", which is a bit ugly
in my eyes.

Would love to see it fixed.

Best regards

Ansgar

> >
> > The problem shows up as well by simply running mvn
> > help:effective-pom, so no test case is needed.  Just put a
> > fragment like this in any plugin stanza:
> >
> > <someConfigurationElement>   Hello!   </someConfigurationElement>
> >
> > ...and then run mvn help:effective-pom, and you'll see:
> >
> > <someConfigurationElement>Hello!</someConfigurationElement>
> >
> > ...in the output.  This is true whether you use CDATA,
> > literal values, entities, or the xml:space="preserve" attribute.
> >
> > Best,
> > Laird
> >
> > --
> > http://about.me/lairdnelson
> >
>
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> -                                                               -
> - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> - Principal Consultant              10 West 24th Street #100    -
> - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
> -                                                               -
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> This message is copyright PD Inc, subject to license 20080407P00.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>