本文整理汇总了Java中org.apache.maven.model.Profile.getDependencyManagement方法的典型用法代码示例。如果您正苦于以下问题:Java Profile.getDependencyManagement方法的具体用法?Java Profile.getDependencyManagement怎么用?Java Profile.getDependencyManagement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Profile
的用法示例。
在下文中一共展示了Profile.getDependencyManagement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResolvedProfileManagedDependencies
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
/**
* This method will scan the dependencies in the dependencyManagement section of the potentially active Profiles in
* this project and return a fully resolved list. Note that while updating the {@link Dependency}
* reference returned will be reflected in the Model as it is the same object, if you wish to remove or add items
* to the Model then you must use {@link #getModel()}
*
* @param session MavenSessionHandler, used by {@link PropertyResolver}
* @return a list of fully resolved {@link ArtifactRef} to the original {@link Dependency} (that were within DependencyManagement)
* @throws ManipulationException if an error occurs
*/
public HashMap<Profile, HashMap<ArtifactRef, Dependency>> getResolvedProfileManagedDependencies( MavenSessionHandler session) throws ManipulationException
{
if ( resolvedProfileManagedDependencies == null )
{
resolvedProfileManagedDependencies = new HashMap<>( );
for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
{
HashMap<ArtifactRef, Dependency> profileDeps = new HashMap<>();
final DependencyManagement dm = profile.getDependencyManagement();
if ( ! ( dm == null || dm.getDependencies() == null ) )
{
resolveDeps( session, dm.getDependencies(), false, profileDeps );
resolvedProfileManagedDependencies.put( profile, profileDeps );
}
}
}
return resolvedProfileManagedDependencies;
}
示例2: getSnapshotsFromManagement
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private Set<ArtifactCoordinates> getSnapshotsFromManagement(Profile profile, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking managed dependencies of profile '" + profile.getId() + "'");
DependencyManagement dependencyManagement = profile.getDependencyManagement();
if (dependencyManagement != null) {
Collection<Dependency> snapshots = Collections2.filter(dependencyManagement.getDependencies(),
new IsSnapshotDependency(propertyResolver));
return Sets.newHashSet(Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}
return Collections.emptySet();
}
示例3: apply
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private boolean apply( final Project project, final Model model ) throws ManipulationException
{
boolean result = false;
final RelocationState state = session.getState( RelocationState.class );
final WildcardMap<ProjectVersionRef> relocations = state.getDependencyRelocations();
logger.debug( "Applying relocation changes to: " + ga( project ) );
DependencyManagement dependencyManagement = model.getDependencyManagement();
if ( dependencyManagement != null )
{
result = updateDependencies( relocations, project.getResolvedManagedDependencies( session ) );
}
result |= updateDependencies( relocations, project.getAllResolvedDependencies( session ) );
for ( final Profile profile : ProfileUtils.getProfiles( session, model) )
{
dependencyManagement = profile.getDependencyManagement();
if ( dependencyManagement != null )
{
result |= updateDependencies( relocations, project.getResolvedProfileManagedDependencies( session ).get( profile ) );
}
result |= updateDependencies( relocations, project.getAllResolvedProfileDependencies( session ).get( profile ) );
}
return result;
}
示例4: applyChanges
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
/**
* For each project in the current build set, reset the version if using project.version
*/
@Override
public Set<Project> applyChanges( final List<Project> projects )
throws ManipulationException
{
final ProjectVersionEnforcingState state = session.getState( ProjectVersionEnforcingState.class );
if ( !session.isEnabled() ||
!session.anyStateEnabled( State.activeByDefault ) ||
state == null || !state.isEnabled() )
{
logger.debug( "Project version enforcement is disabled." );
return Collections.emptySet();
}
final Set<Project> changed = new HashSet<>();
for ( final Project project : projects )
{
final Model model = project.getModel();
if ( model.getPackaging().equals( "pom" ) )
{
enforceProjectVersion( project, model.getDependencies(), changed );
if ( model.getDependencyManagement() != null )
{
enforceProjectVersion( project, model.getDependencyManagement().getDependencies(), changed );
}
final List<Profile> profiles = ProfileUtils.getProfiles( session, model);
if ( profiles != null )
{
for ( final Profile profile : profiles )
{
enforceProjectVersion( project, profile.getDependencies(), changed );
if ( profile.getDependencyManagement() != null )
{
enforceProjectVersion( project, profile.getDependencyManagement().getDependencies(),
changed );
}
}
}
}
}
if (!changed.isEmpty())
{
logger.warn( "Using ${project.version} in pom files may lead to unexpected errors with inheritance." );
}
return changed;
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:53,代码来源:ProjectVersionEnforcingManipulator.java