Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear project.build.sourceEncoding after parsing sources #735

Merged

Conversation

timtebeek
Copy link
Contributor

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Wasn't sure if this exactly captures the issue described in #734 ; from the description there this seemed a good first step.

Anyone you would like to review specifically?

@leveretconey

Have you considered any alternatives or workarounds?

Not really sure we have a lot of other options here; but open to help explore.

@timtebeek timtebeek added the bug Something isn't working label Feb 6, 2024
@timtebeek timtebeek self-assigned this Feb 6, 2024
@leveretconey
Copy link

@timtebeek Thank you! I confirm that this patch does solve by issue.

@timtebeek timtebeek marked this pull request as ready for review February 19, 2024 12:25
JavaParser.Builder<? extends JavaParser, ?> javaParserBuilder = JavaParser.fromJavaVersion()
.styles(styles)
.logCompilationWarningsAndErrors(false);

Object mavenSourceEncoding = mavenProject.getProperties().get("project.build.sourceEncoding");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we would also accept the encoding from the compiler plugin configuration: https://www.baeldung.com/maven-encoding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 175d711 , thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to check if the precedence is correct between the plugin configuration and the project property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to find any exact sources on what takes precedence, but reading this it's likely the plugin indeed.
https://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html

Copy link
Contributor

@knutwannheden knutwannheden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the detail in my comment this LGTM.

@timtebeek timtebeek linked an issue Feb 20, 2024 that may be closed by this pull request
@timtebeek timtebeek merged commit a8dae80 into main Feb 20, 2024
1 check passed
@timtebeek timtebeek deleted the clear-project.build.sourceEncoding-after-parsing-sources branch February 20, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Mistake in detecting encoding of pom.xml
3 participants