diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java index 6c0a03df3..871a5c271 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java @@ -138,7 +138,8 @@ public void createArchetype( ArchetypeCreationRequest request, ArchetypeCreation try { File archetypePomFile = createArchetypeProjectPom( project, request.getProjectBuildingRequest(), - configurationProperties, outputDirectory ); + configurationProperties, outputDirectory, + defaultEncoding ); File archetypeResourcesDirectory = new File( outputDirectory, getTemplateOutputDirectory() ); @@ -391,10 +392,15 @@ else if ( !properties.containsKey( Constants.PACKAGE ) ) * Create the archetype project pom.xml file, that will be used to build the archetype. */ private File createArchetypeProjectPom( MavenProject project, ProjectBuildingRequest buildingRequest, - Properties configurationProperties, File projectDir ) + Properties configurationProperties, File projectDir, + String defaultEncoding ) throws TemplateCreationException, IOException { Model model = new Model(); + if ( StringUtils.isNotBlank( defaultEncoding ) ) + { + model.getProperties().put( "project.build.sourceEncoding", defaultEncoding ); + } model.setModelVersion( "4.0.0" ); // these values should be retrieved from the request with sensible defaults model.setGroupId( configurationProperties.getProperty( Constants.ARCHETYPE_GROUP_ID, project.getGroupId() ) );