[MNG-7216] [Regression] Revert MNG-7170

This reverts commit 5a89973126.

This closes #524
This commit is contained in:
Michael Osipov 2021-08-16 18:08:39 +02:00
parent c76c9d9116
commit 383cabf9e4
3 changed files with 1 additions and 53 deletions

View File

@ -39,8 +39,6 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.building.FileModelSource;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.building.ModelProblem.Severity;
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.shared.utils.io.FileUtils;
@ -85,30 +83,6 @@ public class ProjectBuilderTest
assertNotNull( result.getProject().getParentFile() );
}
public void testBuildFromModelSourceResolvesBasedir()
throws Exception
{
File pomFile = new File( "src/test/resources/projects/modelsourcebasedir/pom.xml" );
MavenSession mavenSession = createMavenSession( null );
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
configuration.setRepositorySession( mavenSession.getRepositorySession() );
ModelSource modelSource = new FileModelSource( pomFile );
ProjectBuildingResult result =
getContainer().lookup( org.apache.maven.project.ProjectBuilder.class ).build( modelSource, configuration );
assertEquals( pomFile.getAbsoluteFile(), result.getProject().getModel().getPomFile().getAbsoluteFile() );
int errors = 0;
for ( ModelProblem p : result.getProblems() )
{
if ( p.getSeverity() == Severity.ERROR )
{
errors++;
}
}
assertEquals( 0, errors );
}
public void testVersionlessManagedDependency()
throws Exception
{

View File

@ -1,19 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test.readparent</groupId>
<artifactId>local-parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>blah</groupId>
<artifactId>blah</artifactId>
<version>0.0.1-SNASPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/blah.jar</systemPath>
</dependency>
</dependencies>
</project>

View File

@ -624,14 +624,7 @@ public class DefaultModelBuilder
throw problems.newModelBuildingException();
}
if ( pomFile != null )
{
model.setPomFile( pomFile );
}
else if ( modelSource instanceof FileModelSource )
{
model.setPomFile( ( (FileModelSource) modelSource ).getFile() );
}
model.setPomFile( pomFile );
problems.setSource( model );
modelValidator.validateRawModel( model, request, problems );