mirror of
https://github.com/apache/maven.git
synced 2025-02-22 01:45:37 +00:00
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:
parent
4f60e7e0a1
commit
d9ac5ea1e5
@ -33,10 +33,10 @@
|
||||
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.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 @@ private List collectProjects( List files, ArtifactRepository localRepository, bo
|
||||
// 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 MavenProject getProject( File pom, ArtifactRepository localRepository )
|
||||
{
|
||||
if ( pom.length() == 0 )
|
||||
{
|
||||
throw new ProjectBuildingException( i18n.format( "empty.descriptor.error", pom.getName() ) );
|
||||
throw new ProjectBuildingException( i18n.format( "empty.descriptor.error", pom ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,6 +291,9 @@ private static List getProjectFiles( CommandLine commandLine )
|
||||
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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user