Skip to content

Commit

Permalink
[MNG-7763] Provide UTF-8 as a default value for project.build.sourceE…
Browse files Browse the repository at this point in the history
…ncoding and project.reporting.outputEncoding (#1085)
  • Loading branch information
gnodet committed Apr 17, 2023
1 parent 0a67219 commit 9e51a8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ void testReportingPluginConfig() throws Exception {
@Test
void testPropertiesNoDuplication() throws Exception {
PomTestWrapper pom = buildPom("properties-no-duplication/sub");
assertEquals(1, ((Properties) pom.getValue("properties")).size());
assertEquals(3, ((Properties) pom.getValue("properties")).size());
assertEquals("child", pom.getValue("properties/pomProfile"));
}

Expand Down Expand Up @@ -1342,8 +1342,10 @@ private void testCompleteModel(PomTestWrapper pom) throws Exception {
assertEquals(1, ((List<?>) pom.getValue("modules")).size());
assertEquals("sub", pom.getValue("modules[1]"));

assertEquals(1, ((Map<?, ?>) pom.getValue("properties")).size());
assertEquals(3, ((Map<?, ?>) pom.getValue("properties")).size());
assertEquals("project-property", pom.getValue("properties[1]/itProperty"));
assertEquals("UTF-8", pom.getValue("properties[1]/project.build.sourceEncoding"));
assertEquals("UTF-8", pom.getValue("properties[1]/project.reporting.outputEncoding"));

assertEquals(1, ((List<?>) pom.getValue("dependencyManagement/dependencies")).size());
assertEquals("org.apache.maven.its", pom.getValue("dependencyManagement/dependencies[1]/groupId"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ under the License.
<project>
<modelVersion>4.0.0</modelVersion>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<repositories>
<repository>
<id>central</id>
Expand Down
6 changes: 4 additions & 2 deletions maven-model-builder/src/site/apt/index.apt
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ Maven Model Builder

* <<<$\{project.build.sourceEncoding\}>>> for
{{{https://cwiki.apache.org/confluence/display/MAVEN/POM+Element+for+Source+File+Encoding}source files encoding}}
(defaults to platform encoding)
(defaults to <<<UTF-8>>> since Maven 4.0.0, no default value was provided in Maven 3.x, meaning that the platform
encoding was used by plugins)

* <<<$\{project.reporting.outputEncoding\}>>> for
{{{https://cwiki.apache.org/confluence/display/MAVENOLD/Reporting+Encoding+Configuration}reporting output files encoding}}
(defaults to <<<UTF-8>>>)
(defaults to <<<UTF-8>>> since Maven 4.0.0, no default value was provided in Maven 3.x, plugins usually defaulting
to <<<UTF-8>>>)

[]

Expand Down

0 comments on commit 9e51a8f

Please sign in to comment.