maven-archetype
maven-archetype copied to clipboard
[ARCHETYPE-548] Resource files without extensions are not included in archetype
Jay Guidos opened ARCHETYPE-548 and commented
Similar to the problem resolved in ARCHETYPE-499, but the patch for that Jira only addresses source files without extensions. Resource files without extensions are still not included
There are are two implementations of getUnpackagedFileSet() in FileArchesetTypeCreator, and only one of them (the one called when a file is considered a source file) has the ARCHETYPE-499 patch.
Issue Links:
-
ARCHETYPE-499 Files with no extension are not included when one creates archetype from project
-
ARCHETYPE-617 Files in a folder with a file that has no extension are not filtered
Remote Links:
3 votes, 6 watchers
Zhang Xiaoyu commented
We met the same problem with version 3.0.1.
Currently we are using locally compiled plugin with below code change, which can work normally:
private FileSet getUnpackagedFileSet( final boolean filtered, final String group, final List<String> groupFiles,
String defaultEncoding )
{
// Set<String> extensions = getExtensions( groupFiles );
List<String> includes = new ArrayList<String>();
List<String> excludes = new ArrayList<String>();
// for ( String extension : extensions )
// {
// includes.add( "**/*." + extension );
// }
for ( String file : groupFiles )
{
if ( StringUtils.isEmpty( getExtension( file ) ) )
{
//include the exact name of file without extension.
includes.add( file );
}
else
{
includes.add( "**/*." + getExtension( file ) );
}
}
includes = new ArrayList<>( new HashSet<>( includes ) );
return createFileSet( excludes, false, filtered, group, includes, defaultEncoding );
}
private String getExtension( String file )
{
return FileUtils.extension( ( file ) );
}