| Summary: | [patch] Set project file encoding based on project.build.sourceEncoding property | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Anders Hammar <anders.g.hammar> | ||||||||
| Component: | m2e | Assignee: | Project Inbox <m2e.core-inbox> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | enhancement | ||||||||||
| Priority: | P3 | CC: | igor, julien.henry | ||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Anders Hammar
Does this sound as a good idea? I'll look into creating a patch and ITs if you thinks so. yes, this does sound like a good idea, but I am not sure if we'll be able to merge your patch for this release. Created attachment 196421 [details]
Patch to set file encoding on imported project
At work we've been using this piece of code for quite some time, and it works great. It would be nice to see this solved in M2E internally, though.
We need to get some ITs for this. If no one beats me to it, I'll do that. Ok, so we set the file encoding for the project based on the 'project.build.sourceEncoding' Maven property. But what about file encoding manually set on any file or folder by the user, should we reset that to the project defined file encoding? I believe we should as that's the only way to ensure that all users have the same setting. Any manually set setting will differ between different users. Our approach so far was to preserve explicit user configuration. This is what we do for project classpath, for example, and this is what we should do for file encoding imho. IDE configuration can be shared via version control system, so inconsistent encoding among project members is not an issue. Inconsistent behaviour between IDE and command line build is an issue, but lets assume the user knows what they are doing. I'm working on a patch (update of Lorant's patch) and a set of ITs. The code should be done already, but I need to review it before submitting it. Created attachment 200681 [details]
Plugin code patch
Created attachment 200682 [details]
Integration tests for the implementation
OK, I'm done. Please note that my patch replaces the one by Lóránt. (In reply to comment #6) > Our approach so far was to preserve explicit user configuration. This is what > we do for project classpath, for example, and this is what we should do for > file encoding imho. IDE configuration can be shared via version control system, > so inconsistent encoding among project members is not an issue. Inconsistent > behaviour between IDE and command line build is an issue, but lets assume the > user knows what they are doing. I'd just like to clarify that the implementation preserves explicit user configuration of encoding on folders and files. However, any user configuration of the Project encoding is replaced by the one specified by the pom property. The reason for this is that I haven't found a way of knowing if the Project encoding is set by the user or by m2e (and if the pom property value changes the project encoding set by m2e needs to be changed). Applied the patches. Thank you. |