boolean test, final String output )
throws MojoExecutionException
{
for ( Iterator it = resources.iterator(); it.hasNext(); )
{
Resource resource = (Resource) it.next();
getLog().debug( "Processing resource dir: " + resource.getDirectory() );
List excludes = new ArrayList( resource.getExcludes() );
// automatically exclude java files: eclipse doesn't have the concept of resource directory so it will
// try to compile any java file found in maven resource dirs
excludes.add( JAVA_FILE_PATTERN );
// TODO: figure out how to merge if the same dir is specified twice
// with different in/exclude patterns.
File resourceDirectory = new File( /* basedir, */resource.getDirectory() );
if ( !resourceDirectory.exists() || !resourceDirectory.isDirectory() )
{
getLog().debug( "Resource dir: " + resourceDirectory + " either missing or not a directory." );
continue;
}
String resourcePath =
IdeUtils.toRelativeAndFixSeparator( workspaceProjectBaseDir, resourceDirectory,
!workspaceProjectBaseDir.equals( basedir ) );
String thisOutput = output;
if ( thisOutput != null )
{
// sometimes thisOutput is already an absolute path
File outputFile = new File( thisOutput );
if ( !outputFile.isAbsolute() )
{
outputFile = new File( workspaceProjectBaseDir, thisOutput );
}
// create output dir if it doesn't exist
outputFile.mkdirs();
if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
{
outputFile = new File( outputFile, resource.getTargetPath() );
// create output dir if it doesn't exist
outputFile.mkdirs();
}
getLog().debug(
"Making relative and fixing separator: { " + workspaceProjectBaseDir + ", "
+ outputFile + ", false }." );
thisOutput = IdeUtils.toRelativeAndFixSeparator( workspaceProjectBaseDir, outputFile, false );
}
EclipseSourceDir resourceDir =
new EclipseSourceDir( resourcePath, thisOutput, true, test, resource.getIncludes(), excludes,
resource.isFiltering() );
if ( !directories.add( resourceDir ) )
{
EclipseSourceDir originalDir = (EclipseSourceDir) get( directories, resourceDir );