Put back in repository helper due to problems of building with clean repo.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@700813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-10-01 15:33:08 +00:00
parent 7f70506c55
commit d7ae13be90
4 changed files with 113 additions and 36 deletions

View File

@ -93,6 +93,8 @@ public class DefaultMavenProjectBuilder
private ProjectBuilder projectBuilder;
private RepositoryHelper repositoryHelper;
private Logger logger;
//DO NOT USE, it is here only for backward compatibility reasons. The existing
@ -129,7 +131,7 @@ public class DefaultMavenProjectBuilder
throws ProjectBuildingException
{
MavenProject project = readModelFromLocalPath( "unknown", projectDescriptor, new PomArtifactResolver(
config.getLocalRepository(), buildArtifactRepositories(
config.getLocalRepository(), repositoryHelper.buildArtifactRepositories(
getSuperProject( config, projectDescriptor, true ).getModel() ), artifactResolver ), config );
project.setFile( projectDescriptor );
@ -181,28 +183,20 @@ public class DefaultMavenProjectBuilder
{
return project;
}
File originalArtifactFile = artifact.getFile();
File f;
if ( !"pom".equals( artifact.getType() ) )
{
Artifact a = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion(), artifact.getScope() );
f = new File( localRepository.getBasedir(), localRepository.pathOf( a ) );
} else
{
f = (artifact.getFile() != null) ? artifact.getFile() : new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
}
File f = (artifact.getFile() != null) ? artifact.getFile() :
new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );;
repositoryHelper.findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository );
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteArtifactRepositories );
artifactRepositories.addAll( buildArtifactRepositories( getSuperProject( config, f, false ).getModel() ) );
artifactRepositories.addAll( repositoryHelper.buildArtifactRepositories( getSuperProject( config, artifact.getFile(), false ).getModel() ) );
project = readModelFromLocalPath( "unknown", f, new PomArtifactResolver( config.getLocalRepository(), artifactRepositories, artifactResolver ), config );
project = buildInternal( project.getModel(), config, f, project.getParentFile(), false );
artifact.setFile( originalArtifactFile );
project = readModelFromLocalPath( "unknown", artifact.getFile(), new PomArtifactResolver( config.getLocalRepository(), artifactRepositories, artifactResolver ), config );
project = buildInternal( project.getModel(), config, artifact.getFile(), project.getParentFile(), false );
artifact.setFile( f );
project.setVersion( artifact.getVersion() );
hm.put( artifact.getId(), project );
@ -619,20 +613,4 @@ public class DefaultMavenProjectBuilder
setBuildOutputDirectoryOnParent( parent );
}
}
public List buildArtifactRepositories( Model model )
throws ProjectBuildingException
{
try
{
return mavenTools.buildArtifactRepositories( model.getRepositories() );
}
catch ( InvalidRepositoryException e )
{
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
throw new ProjectBuildingException( projectId, e.getMessage(), e );
}
}
}

View File

@ -89,6 +89,9 @@ under the License.
<role-hint>default</role-hint>
<implementation>org.apache.maven.project.DefaultMavenProjectBuilder</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.RepositoryHelper</role>
</requirement>
<requirement>
<role>org.apache.maven.project.builder.ProjectBuilder</role>
</requirement>
@ -116,6 +119,27 @@ under the License.
</requirement>
</requirements>
</component>
<!--Eliminate this component after Mercury Integration-->
<component>
<role>org.apache.maven.project.RepositoryHelper</role>
<implementation>org.apache.maven.project.DefaultRepositoryHelper</implementation>
<requirements>
<requirement>
<role>org.apache.maven.profiles.build.ProfileAdvisor</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
</requirement>
</requirements>
</component>
<!--
|
|

View File

@ -19,6 +19,41 @@ under the License.
<plexus>
<components>
<!--Eliminate this component after Mercury Integration-->
<component>
<role>org.apache.maven.project.RepositoryHelper</role>
<implementation>org.apache.maven.project.DefaultRepositoryHelper</implementation>
<requirements>
<requirement>
<role>org.apache.maven.profiles.build.ProfileAdvisor</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
</requirement>
</requirements>
</component>
<!-- Due to PLX-108, have to work around it...
<component>
<role>org.apache.maven.artifact.ArtifactResolver</role>
<implementation>org.apache.maven.project.TestArtifactResolvertion>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
</requirements>
</component>
-->
<component>
<role>org.apache.maven.profiles.injection.ProfileInjector</role>
<role-hint>test</role-hint>
@ -79,6 +114,9 @@ under the License.
<role-hint>test</role-hint>
<implementation>org.apache.maven.project.TestProjectBuilder</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.RepositoryHelper</role>
</requirement>
<requirement>
<role>org.apache.maven.project.builder.ProjectBuilder</role>
</requirement>

View File

@ -18,7 +18,41 @@ under the License.
-->
<plexus>
<components>
<components><!--Eliminate this component after Mercury Integration-->
<component>
<role>org.apache.maven.project.RepositoryHelper</role>
<implementation>org.apache.maven.project.DefaultRepositoryHelper</implementation>
<requirements>
<requirement>
<role>org.apache.maven.profiles.build.ProfileAdvisor</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
</requirement>
</requirements>
</component>
<!-- Due to PLX-108, have to work around it...
<component>
<role>org.apache.maven.artifact.ArtifactResolver</role>
<implementation>org.apache.maven.project.TestArtifactResolvertion>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
</requirements>
</component>
-->
<component>
<role>org.apache.maven.profiles.injection.ProfileInjector</role>
<role-hint>test</role-hint>
@ -77,6 +111,9 @@ under the License.
<role-hint>test</role-hint>
<implementation>org.apache.maven.project.TestProjectBuilder</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.RepositoryHelper</role>
</requirement>
<requirement>
<role>org.apache.maven.project.builder.ProjectBuilder</role>
</requirement>