Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343818 - File encoding for resources
Summary: File encoding for resources
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 06:58 EDT by Anders Hammar CLA
Modified: 2021-04-19 13:27 EDT (History)
3 users (show)

See Also:


Attachments
Patch in git format (11.99 KB, patch)
2011-04-28 03:11 EDT, Anders Hammar CLA
no flags Details | Diff
Updated patch (4.62 KB, patch)
2011-04-28 08:21 EDT, Anders Hammar CLA
fbricon: iplog+
Details | Diff
integration tests (30.36 KB, patch)
2011-04-28 10:11 EDT, Anders Hammar CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Hammar CLA 2011-04-26 06:58:39 EDT
Build Identifier: 

Similar to how encoding is set for Java sources (issue #340507) folder, I think that the encoding should be automatically set for resources folders.

I suggest that the encoding configured for resources:resources and resources:testResources should be used. It is highly unlikely that different encoding is configured for those two goals, but it is possible configuration wise.

Reproducible: Always

Steps to Reproduce:
1. Create a Maven project
2. Right-click on src/main/resources folder and select 'Properties'
3. For Text file encoding it states "Inherited from container" which most likely will be the wrong encoding for your Maven project
Comment 1 Anders Hammar CLA 2011-04-26 07:03:08 EDT
There is one slight difference between encoding configured for maven-compiler-plugin and maven-resources-plugin. For the resources plugin, the encoding is only used when doing filtering.
But I still think that the configured encoding is a safe guess for any created file in that folder, even though filtering isn't configured for it. Do you agree?
Comment 2 Milos Kleint CLA 2011-04-26 07:16:01 EDT
slightly unrelated but as far as I remember, netbeans is using the the maven encoding for resources  as well. The encoding property (project.build.sourceEncoding) is even used from the project customizer UI to change the "project" encoding. if the maven definition is not present, it falls back to OS platform specific default.
Comment 3 Anders Hammar CLA 2011-04-27 02:39:01 EDT
(In reply to comment #2)
> slightly unrelated but as far as I remember, netbeans is using the the maven
> encoding for resources  as well. The encoding property
> (project.build.sourceEncoding) is even used from the project customizer UI to
> change the "project" encoding. if the maven definition is not present, it falls
> back to OS platform specific default.

Filed bug 343927 for this enhancement.
Comment 4 Anders Hammar CLA 2011-04-28 03:11:39 EDT
Created attachment 194233 [details]
Patch in git format

I've attached a patch for this, heavily influence by the patch for bug 340507. I have tested it manually and will continue to work on integration tests for it.
Comment 5 Anders Hammar CLA 2011-04-28 08:21:43 EDT
Created attachment 194256 [details]
Updated patch

Retry: attached an updated patch which should be in correct git format
Comment 6 Anders Hammar CLA 2011-04-28 08:23:24 EDT
I sent a pull request in Github for the integration tests.
Comment 7 Anders Hammar CLA 2011-04-28 10:11:24 EDT
Created attachment 194272 [details]
integration tests

Patch file for integration tests added, replacing the pull request sent in Github.
Comment 8 Igor Fedorenko CLA 2011-04-29 23:30:52 EDT
Applied the patch with minor fixes to one of test projects (was missing extra resource folders). Thank you.
Comment 9 Fred Bricon CLA 2013-02-11 19:16:25 EST
Comment on attachment 194256 [details]
Updated patch

cleaning IP Log up
Comment 10 Denis Roy CLA 2021-04-19 13:27:04 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/