mirror of
https://github.com/apache/maven.git
synced 2025-02-08 11:05:37 +00:00
MNG-2819 Prevent extension scanner from looping infinitely when projects are in a flattened structure
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@505663 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5288374ef1
commit
17817ccc00
@ -24,6 +24,7 @@
|
|||||||
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -125,17 +126,45 @@ private void checkModulesForExtensions( File containingPom, Model model, Artifac
|
|||||||
|
|
||||||
getLogger().debug( "Scanning module: " + moduleSubpath );
|
getLogger().debug( "Scanning module: " + moduleSubpath );
|
||||||
|
|
||||||
File modulePom = new File( basedir, moduleSubpath );
|
File modulePomDirectory;
|
||||||
|
|
||||||
if ( modulePom.isDirectory() )
|
try
|
||||||
|
{
|
||||||
|
modulePomDirectory = new File( basedir, moduleSubpath ).getCanonicalFile();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// We need to make sure we don't loop infinitely in the case where we have
|
||||||
|
// something like:
|
||||||
|
//
|
||||||
|
// <modules>
|
||||||
|
// <module>../MNGECLIPSE-256web</module>
|
||||||
|
// <module>../MNGECLIPSE-256utility</module>
|
||||||
|
// </modules>
|
||||||
|
//
|
||||||
|
// Where once we walk into the first module it will just get its parent dir
|
||||||
|
// containing its POM over and over again unless we make a comparison to
|
||||||
|
// basedir and the modulePomDirectory.
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if ( modulePomDirectory.equals( basedir.getCanonicalFile() ) )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new ExtensionScanningException( "Error getting canonical path for modulePomDirectory.", e );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( modulePomDirectory.isDirectory() )
|
||||||
{
|
{
|
||||||
getLogger().debug(
|
getLogger().debug(
|
||||||
"Assuming POM file 'pom.xml' in module: " + moduleSubpath + " under basedir: "
|
"Assuming POM file 'pom.xml' in module: " + moduleSubpath + " under basedir: "
|
||||||
+ basedir );
|
+ basedir );
|
||||||
modulePom = new File( modulePom, "pom.xml" );
|
modulePomDirectory = new File( modulePomDirectory, "pom.xml" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !modulePom.exists() )
|
if ( !modulePomDirectory.exists() )
|
||||||
{
|
{
|
||||||
getLogger().debug(
|
getLogger().debug(
|
||||||
"Cannot find POM for module: " + moduleSubpath
|
"Cannot find POM for module: " + moduleSubpath
|
||||||
@ -143,7 +172,7 @@ private void checkModulesForExtensions( File containingPom, Model model, Artifac
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
scanForBuildExtensions( modulePom, localRepository, globalProfileManager, pomFilesById );
|
scanForBuildExtensions( modulePomDirectory, localRepository, globalProfileManager, pomFilesById );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user