mirror of https://github.com/apache/maven.git
Adding new unit test for non-recursive run, where one of the modules that should NOT be read contains an invalid parent reference.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@613254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3dbe70a25c
commit
b731e783fa
|
@ -181,7 +181,7 @@ public class DefaultBuildExtensionScanner
|
|||
"POM: " + modelPom
|
||||
+ " is not in the current reactor. Its modules will not be scanned." );
|
||||
}
|
||||
else
|
||||
else if ( request.isRecursive() )
|
||||
{
|
||||
checkModulesForExtensions( modelPom,
|
||||
model,
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package org.apache.maven.embedder.project;
|
||||
|
||||
import org.apache.maven.embedder.Configuration;
|
||||
import org.apache.maven.embedder.DefaultConfiguration;
|
||||
import org.apache.maven.embedder.MavenEmbedder;
|
||||
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
|
||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionResult;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class BadModuleNotRecursiveTest
|
||||
extends TestCase
|
||||
{
|
||||
public void test()
|
||||
throws Exception
|
||||
{
|
||||
Configuration configuration = new DefaultConfiguration();
|
||||
configuration.setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() );
|
||||
MavenEmbedder embedder = new MavenEmbedder( configuration );
|
||||
|
||||
File pom = new File( "src/test/projects/bad-module-non-recursive/pom.xml" ).getCanonicalFile();
|
||||
|
||||
System.out.println( pom.getCanonicalFile() );
|
||||
|
||||
DefaultMavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
||||
request.setOffline( false );
|
||||
request.setUseReactor( false );
|
||||
request.setRecursive( false );
|
||||
request.setLoggingLevel( Logger.LEVEL_DEBUG );
|
||||
request.setPom( pom );
|
||||
request.setBaseDirectory( pom.getParentFile() );
|
||||
MavenExecutionResult result = embedder.readProjectWithDependencies( request );
|
||||
MavenProject project = result.getProject();
|
||||
|
||||
if ( result.hasExceptions() )
|
||||
{
|
||||
for ( Iterator it = result.getExceptions().iterator(); it.hasNext(); )
|
||||
{
|
||||
Exception ex = (Exception) it.next();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
assertNotNull( project );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>other</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>badmodule</groupId>
|
||||
<artifactId>badmodule</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>badmodule</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>badmodule</groupId>
|
||||
<artifactId>good</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>badmodule</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>goodmodule</module>
|
||||
<module>badmodule</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue