{
getLogger().info( "NOTE: Using release-pom: " + file + " in reactor build." );
usingReleasePom = true;
}
MavenProject project = getProject( file, request );
if ( isRoot )
{
project.setExecutionRoot( true );
}
if ( ( project.getPrerequisites() != null ) && ( project.getPrerequisites().getMaven() != null ) )
{
DefaultArtifactVersion version = new DefaultArtifactVersion( project.getPrerequisites().getMaven() );
if ( runtimeInformation.getApplicationVersion().compareTo( version ) < 0 )
{
throw new BuildFailureException( "Unable to build project '" + project.getFile() +
"; it requires Maven version " + version.toString() );
}
}
if ( ( project.getModules() != null ) && !project.getModules().isEmpty() && request.isRecursive() )
{
// TODO: Really should fail if it was not? What if it is aggregating - eg "ear"?
project.setPackaging( "pom" );
File basedir = file.getParentFile();
// Initial ordering is as declared in the modules section
List moduleFiles = new ArrayList( project.getModules().size() );
for ( Iterator i = project.getModules().iterator(); i.hasNext(); )
{
String name = (String) i.next();
if ( StringUtils.isEmpty( StringUtils.trim( name ) ) )
{
getLogger().warn(
"Empty module detected. Please check you don't have any empty module definitions in your POM." );
continue;
}
File moduleFile = new File( basedir, name );
if ( moduleFile.exists() && moduleFile.isDirectory() )
{
if ( usingReleasePom )
{
moduleFile = new File( basedir, name + "/" + Maven.RELEASE_POMv4 );
}
else
{
moduleFile = new File( basedir, name + "/" + Maven.POMv4 );
}
}
if ( Os.isFamily( "windows" ) )
{
// we don't canonicalize on unix to avoid interfering with symlinks
try
{
moduleFile = moduleFile.getCanonicalFile();
}
catch ( IOException e )
{
throw new MavenExecutionException( "Unable to canonicalize file name " + moduleFile, e );
}
}
else
{
moduleFile = new File( moduleFile.toURI().normalize() );
}
moduleFiles.add( moduleFile );
}
List collectedProjects =
collectProjects( moduleFiles, request, false );
projects.addAll( collectedProjects );
project.setCollectedProjects( collectedProjects );
}
projects.add( project );
}
return projects;