mirror of https://github.com/apache/maven.git
o Revised API
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@797968 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70f22200a0
commit
38cec71dcf
|
@ -234,6 +234,9 @@ public class DefaultModelBuilder
|
|||
throw new ModelBuildingException( problems );
|
||||
}
|
||||
|
||||
putCache( request.getModelCache(), resultModel.getGroupId(), resultModel.getArtifactId(),
|
||||
resultModel.getVersion(), ModelCacheTag.EFFECTIVE, resultModel );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -565,7 +568,7 @@ public class DefaultModelBuilder
|
|||
|
||||
ModelBuildingRequest importRequest = null;
|
||||
|
||||
List<Model> importModels = null;
|
||||
List<DependencyManagement> importMngts = null;
|
||||
|
||||
for ( Iterator<Dependency> it = depMngt.getDependencies().iterator(); it.hasNext(); )
|
||||
{
|
||||
|
@ -582,6 +585,8 @@ public class DefaultModelBuilder
|
|||
String artifactId = dependency.getArtifactId();
|
||||
String version = dependency.getVersion();
|
||||
|
||||
DependencyManagement importMngt;
|
||||
|
||||
Model importModel =
|
||||
getCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.EFFECTIVE );
|
||||
|
||||
|
@ -630,22 +635,27 @@ public class DefaultModelBuilder
|
|||
|
||||
importModel = importResult.getEffectiveModel();
|
||||
|
||||
putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.EFFECTIVE, importModel );
|
||||
importMngt = importModel.getDependencyManagement();
|
||||
}
|
||||
else
|
||||
{
|
||||
importModel = ModelUtils.cloneModel( importModel );
|
||||
importMngt = ModelUtils.cloneDependencyManagement( importModel.getDependencyManagement() );
|
||||
}
|
||||
|
||||
if ( importModels == null )
|
||||
if ( importMngt == null )
|
||||
{
|
||||
importModels = new ArrayList<Model>();
|
||||
continue;
|
||||
}
|
||||
|
||||
importModels.add( importModel );
|
||||
if ( importMngts == null )
|
||||
{
|
||||
importMngts = new ArrayList<DependencyManagement>();
|
||||
}
|
||||
|
||||
importMngts.add( importMngt );
|
||||
}
|
||||
|
||||
dependencyManagementImporter.importManagement( model, importModels, request );
|
||||
dependencyManagementImporter.importManagement( model, importMngts, request );
|
||||
}
|
||||
|
||||
private <T> void putCache( ModelCache modelCache, String groupId, String artifactId, String version,
|
||||
|
|
|
@ -40,7 +40,8 @@ public class DefaultDependencyManagementImporter
|
|||
implements DependencyManagementImporter
|
||||
{
|
||||
|
||||
public void importManagement( Model target, List<? extends Model> sources, ModelBuildingRequest request )
|
||||
public void importManagement( Model target, List<? extends DependencyManagement> sources,
|
||||
ModelBuildingRequest request )
|
||||
{
|
||||
if ( sources != null && !sources.isEmpty() )
|
||||
{
|
||||
|
@ -61,19 +62,14 @@ public class DefaultDependencyManagementImporter
|
|||
target.setDependencyManagement( depMngt );
|
||||
}
|
||||
|
||||
for ( Model source : sources )
|
||||
for ( DependencyManagement source : sources )
|
||||
{
|
||||
DependencyManagement depMngtImport = source.getDependencyManagement();
|
||||
|
||||
if ( depMngtImport != null )
|
||||
for ( Dependency dependency : source.getDependencies() )
|
||||
{
|
||||
for ( Dependency dependency : depMngtImport.getDependencies() )
|
||||
String key = dependency.getManagementKey();
|
||||
if ( !dependencies.containsKey( key ) )
|
||||
{
|
||||
String key = dependency.getManagementKey();
|
||||
if ( !dependencies.containsKey( key ) )
|
||||
{
|
||||
dependencies.put( key, dependency );
|
||||
}
|
||||
dependencies.put( key, dependency );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.model.composition;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.model.DependencyManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
|
||||
|
@ -33,12 +34,12 @@ public interface DependencyManagementImporter
|
|||
{
|
||||
|
||||
/**
|
||||
* Imports the dependency management of the specified source models into the given target model.
|
||||
* Imports the specified dependency management sections into the given target model.
|
||||
*
|
||||
* @param target The model into which to import the dependency management section, must not be <code>null</code>.
|
||||
* @param sources The models from which to import the dependency management sections, may be <code>null</code>.
|
||||
* @param sources The dependency management sections to import, may be <code>null</code>.
|
||||
* @param request The model building request that holds further settings, must not be {@code null}.
|
||||
*/
|
||||
void importManagement( Model target, List<? extends Model> sources, ModelBuildingRequest request );
|
||||
void importManagement( Model target, List<? extends DependencyManagement> sources, ModelBuildingRequest request );
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue