You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Maarten Mulders <mt...@apache.org> on 2023/04/13 07:27:06 UTC

Re: [DISCUSS] Apache Maven 4.0 with UTF-8 by default

A little late to the party, but here's an off-list reply I got when 
Geoffrey De Smet (creator of OptaPlanner) asked me about this very same 
topic on Twitter:

https://twitter.com/GeoffreyDeSmet/status/1646074136337215494

For those who don't want to use Twitter, let me summarise the conversation:

 > Every #Maven pom.xml I see overrides <project.build.sourceEncoding> 
to UTF-8,
 > to create reproducible builds because Maven 3 reads files differently 
on Windows than Linux/Mac out-of-the-box.
 > @mthmulders Is this a reasonable change request?

I replied pointing to this conversation. Geoffrey could read it, but 
since he isn't on this list he couldn't join the discussion. He replied 
(over Twitter, again):

 > Yes,I could read it.
 > I couldn't figure out how to reply to it (in reasonable time).
 > Good proposal to set sourceEncoding to UTF-8 by default in Maven 4. I 
hope it gets accepted.


Thanks,

Maarten

On 16/03/2023 21:49, Jorge Solórzano wrote:
> Yes, please, that is the point, avoid to set the two properties.
> 
> On Thu, Mar 16, 2023, 21:04 Guillaume Nodet <gn...@apache.org> wrote:
> 
>> If the point is to have the default encoding set to UTF-8, which I
>> wholeheartedly agree with, could we go for a simple way, i.e. provide a
>> default value for the two properties project.build.sourceEncoding and
>> project.reporting.outputEncoding, instead of modifying the Model ?
>>
>> It's just we have not broken the POM 4.0.0 model so far and I've not heard
>> any real plan for that.  Or what this would actually mean in terms of
>> migration, etc...  My understanding is that the build/consumer pom could
>> help, but not sure actually how...
>>
>> Le mer. 15 mars 2023 à 15:17, Jorge Solórzano <jo...@gmail.com> a écrit :
>>
>>> Hi Maven Devs,
>>>
>>> I want to bring up the discussion about the default encoding used in
>>> Maven, specifically Maven 4.0+ (since it's still in alpha it could be
>>> done for that release or possibly wait another decade), we are in
>>> 2023, and we still get an encoding warning[1] that should be handled
>>> manually by users, and I think there is general consensus that UTF-8
>>> is the clear winner as the default encoding for the Java platform, the
>>> JEP 400[2] is already delivered in Java 18, so the Maven project
>>> should also revisit this default setting and change it from the
>>> platform encoding to UTF-8 by default.
>>>
>>> Specifically, I'm talking about avoiding including
>>> <project.build.sourceEncoding>[3] and
>>> <project.reporting.outputEncoding>[4] on every project, and possibly
>>> if the POM Model Version 5.0.0[5] is included with Maven 4.x, and
>>> default to UTF-8 [6].
>>>
>>> Doing a quick search in GitHub, there are a lot of projects that
>>> explicitly set UTF-8 by default[7], probably more than any other
>>> encoding, and projects that require a different encoding could still
>>> set this property in the project.
>>>
>>> Regards,
>>>
>>> [1] https://maven.apache.org/general.html#encoding-warning
>>> [2] https://openjdk.org/jeps/400
>>> [3]
>>>
>> https://cwiki.apache.org/confluence/display/MAVEN/POM+Element+for+Source+File+Encoding
>>> [4]
>>>
>> https://cwiki.apache.org/confluence/display/MAVENOLD/Reporting+Encoding+Configuration
>>> [5]
>>>
>> https://cwiki.apache.org/confluence/display/MAVEN/POM+Model+Version+5.0.0
>>> [6] https://issues.apache.org/jira/browse/MNG-2216
>>> [7]
>>>
>> https://github.com/search?l=Maven+POM&q=%22%3Cproject.build.sourceEncoding%3EUTF-8%3C%2Fproject.build.sourceEncoding%3E%22+language%3A%22Maven+POM%22&type=code
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>
>> --
>> ------------------------
>> Guillaume Nodet
>>
> 

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