use consistent ordering for reactored projects

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@168569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-05-06 08:22:28 +00:00
parent 4f60e7e0a1
commit d9ac5ea1e5
2 changed files with 16 additions and 8 deletions

View File

@ -33,10 +33,10 @@ import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.ProjectSorter;
import org.apache.maven.reactor.ReactorException;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.Mirror;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@ -45,8 +45,6 @@ import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.dag.CycleDetectedException;
import java.io.File;
@ -183,14 +181,21 @@ public class DefaultMaven
// TODO: Really should fail if it was not? What if it is aggregating - eg "ear"?
project.setPackaging( "pom" );
String includes = StringUtils.join( project.getModules().iterator(), "/pom.xml," ) + "/pom.xml";
File basedir = file.getParentFile();
if ( includes.indexOf( ".." ) >= 0 )
// Initial ordering is as declared in the modules section
List moduleFiles = new ArrayList( project.getModules().size() );
for ( Iterator i = project.getModules().iterator(); i.hasNext(); )
{
throw new ProjectBuildingException( "Modules may not include '..'" );
String name = (String) i.next();
if ( name.indexOf( '/' ) >= 0 )
{
String message = "Illegal module name: " + name + " (cannot contain path characters)";
throw new ReactorException( message );
}
moduleFiles.add( new File( basedir, name + "/pom.xml" ) );
}
List moduleFiles = FileUtils.getFiles( project.getFile().getParentFile(), includes, null );
List collectedProjects = collectProjects( moduleFiles, localRepository, recursive );
projects.addAll( collectedProjects );
project.setCollectedProjects( collectedProjects );
@ -276,7 +281,7 @@ public class DefaultMaven
{
if ( pom.length() == 0 )
{
throw new ProjectBuildingException( i18n.format( "empty.descriptor.error", pom.getName() ) );
throw new ProjectBuildingException( i18n.format( "empty.descriptor.error", pom ) );
}
}

View File

@ -291,6 +291,9 @@ public class MavenCli
String excludes = System.getProperty( "maven.reactor.excludes", POMv4 );
files = FileUtils.getFiles( userDir, includes, excludes );
// make sure there is consistent ordering on all platforms, rather than using the filesystem ordering
Collections.sort( files );
}
else
{