Java 类org.apache.maven.model.BuildBase 实例源码

项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateBuildBase
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateBuildBase( BuildBase value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null );
        iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
        iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" );
        findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null );
        findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" );
        updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
        iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
    }
}
项目:unleash-maven-plugin    文件:CheckPluginDependencyVersions.java   
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(Profile profile,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking managed plugins of profile '" + profile.getId() + "'");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  BuildBase build = profile.getBuild();
  if (build != null) {
    PluginManagement pluginManagement = build.getPluginManagement();
    if (pluginManagement != null) {
      for (Plugin plugin : pluginManagement.getPlugins()) {
        Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
            new IsSnapshotDependency(propertyResolver));
        if (!snapshots.isEmpty()) {
          result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
              Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
        }
      }
    }
  }
  return result;
}
项目:unleash-maven-plugin    文件:CheckPluginDependencyVersions.java   
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshots(Profile profile,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking direct plugin references of profile '" + profile.getId() + "'");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  BuildBase build = profile.getBuild();
  if (build != null) {
    for (Plugin plugin : build.getPlugins()) {
      Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
          new IsSnapshotDependency(propertyResolver));
      if (!snapshots.isEmpty()) {
        result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
            Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
      }
    }
  }
  return result;
}
项目:ono-extra-enforcer-rules    文件:AbstractRule.java   
private Set<BuildBase> getDefinedActiveBuilds(MavenProject project) {
    HashSet<BuildBase> activeBuilds = new HashSet<>();
    final Model originalModel = project.getOriginalModel();
    final Build build = originalModel.getBuild();
    activeBuilds.add(build);

    final List<Profile> originalProfiles = originalModel.getProfiles();
    if (originalProfiles != null) {
        for (Profile profile : project.getActiveProfiles()) {
            // check active profile is defined in project
            for (Profile originalProfile : originalProfiles) {
                if (originalProfile.equals(profile)) {
                    activeBuilds.add(originalProfile.getBuild());
                }
            }
        }
    }
    // remove possible null entries
    activeBuilds.remove(null);
    return activeBuilds;
}
项目:maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateBuildBase
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateBuildBase( BuildBase value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null );
        iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
        iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" );
        findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null );
        findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" );
        updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
        iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
    }
}
项目:pom-manipulation-ext    文件:Project.java   
public Map<String, Plugin> getPluginMap( final ModelBase base )
{
    final BuildBase build;
    if ( base instanceof Model )
    {
        build = ( (Model) base ).getBuild();
    }
    else
    {
        build = ( (Profile) base ).getBuild();
    }

    if ( build == null )
    {
        return Collections.emptyMap();
    }

    final Map<String, Plugin> result = build.getPluginsAsMap();
    if ( result == null )
    {
        return Collections.emptyMap();
    }

    return result;
}
项目:oceano    文件:MavenModelMerger.java   
@Override
protected void mergeBuildBase_Filters( BuildBase target, BuildBase source, boolean sourceDominant,
                                       Map<Object, Object> context )
{
    List<String> src = source.getFilters();
    if ( !src.isEmpty() )
    {
        List<String> tgt = target.getFilters();
        Set<String> excludes = new LinkedHashSet<String>( tgt );
        List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
        merged.addAll( tgt );
        for ( String s : src )
        {
            if ( !excludes.contains( s ) )
            {
                merged.add( s );
            }
        }
        target.setFilters( merged );
    }
}
项目:unleash-maven-plugin    文件:CheckPluginVersions.java   
private Set<ArtifactCoordinates> getSnapshotsFromManagement(Profile profile, PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking managed plugins of profile '" + profile.getId() + "'");
  BuildBase build = profile.getBuild();
  if (build != null) {
    PluginManagement pluginManagement = build.getPluginManagement();
    if (pluginManagement != null) {
      Collection<Plugin> snapshots = Collections2.filter(pluginManagement.getPlugins(),
          new IsSnapshotPlugin(propertyResolver));
      return Sets.newHashSet(Collections2.transform(snapshots, PluginToCoordinates.INSTANCE));
    }
  }
  return Collections.emptySet();
}
项目:unleash-maven-plugin    文件:CheckPluginVersions.java   
private Set<ArtifactCoordinates> getSnapshots(Profile profile, PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking direct plugin references of profile '" + profile.getId() + "'");
  BuildBase build = profile.getBuild();
  if (build != null) {
    Collection<Plugin> snapshots = Collections2.filter(build.getPlugins(), new IsSnapshotPlugin(propertyResolver));
    return Sets.newHashSet(Collections2.transform(snapshots, PluginToCoordinates.INSTANCE));
  }
  return Collections.emptySet();
}
项目:ono-extra-enforcer-rules    文件:AbstractRule.java   
private boolean ruleDefinedInProject(MavenProject project) {
    for (BuildBase activeBuild : getDefinedActiveBuilds(project)) {
        final Plugin plugin = activeBuild.getPluginsAsMap().get("org.apache.maven.plugins:maven-enforcer-plugin");
        if (plugin != null) {
            for (PluginExecution execution : plugin.getExecutions()) {
                if (isRuleInConfiguration(execution, this.getClass().getSimpleName())) {
                    return true;
                }
            }
        }
    }
    return false;
}
项目:che    文件:MavenModelUtil.java   
private static void convertBaseBuild(
    BuildBase build, MavenBuildBase mavenBuild, File projectDir) {
  mavenBuild.setDefaultGoal(build.getDefaultGoal());
  mavenBuild.setDirectory(relativize(projectDir, build.getDirectory()));
  mavenBuild.setFinalName(build.getFinalName());
  mavenBuild.setResources(convenrtResources(build.getResources(), projectDir));
  mavenBuild.setTestResources(convenrtResources(build.getTestResources(), projectDir));
  List<String> filters = build.getFilters();
  if (filters == null) {
    mavenBuild.setFilters(Collections.emptyList());
  } else {
    mavenBuild.setFilters(filters);
  }
}
项目:che    文件:MavenModelUtil.java   
private static void convertToMavenBuildBase(
    MavenBuildBase modelBuild, BuildBase build, File projectDir) {
  build.setFinalName(modelBuild.getFinalName());
  build.setDefaultGoal(modelBuild.getDefaultGoal());
  build.setDirectory(relativize(projectDir, modelBuild.getDirectory()));
  build.setFilters(modelBuild.getFilters());
  build.setResources(convertToMavenResources(modelBuild.getResources(), projectDir));
  build.setTestResources(convertToMavenResources(modelBuild.getTestResources(), projectDir));
}
项目:pom-manipulation-ext    文件:DistributionEnforcingManipulatorTest.java   
private void assertSkip( final Model model, final String profileId, final boolean deploy, final boolean state )
{
    BuildBase build = null;
    if ( profileId != null )
    {
        final List<Profile> profiles = model.getProfiles();
        if ( profiles != null )
        {
            for ( final Profile profile : profiles )
            {
                if ( profileId.equals( profile.getId() ) )
                {
                    build = profile.getBuild();
                }
            }
        }
    }
    else
    {
        build = model.getBuild();
    }

    assertThat( build, notNullValue() );

    final Plugin plugin =
        build.getPluginsAsMap()
             .get( ga( MAVEN_PLUGIN_GROUPID, deploy ? MAVEN_DEPLOY_ARTIFACTID : MAVEN_INSTALL_ARTIFACTID ) );

    assertThat( plugin, notNullValue() );

    assertThat( plugin.getConfiguration()
                      .toString()
                      .contains( "<skip>" + state + "</skip>" ), equalTo( true ) );
}
项目:oceano    文件:ModelMerger.java   
protected void mergeBuildBase( BuildBase target, BuildBase source, boolean sourceDominant,
                               Map<Object, Object> context )
{
    mergePluginConfiguration( target, source, sourceDominant, context );
    mergeBuildBase_DefaultGoal( target, source, sourceDominant, context );
    mergeBuildBase_FinalName( target, source, sourceDominant, context );
    mergeBuildBase_Directory( target, source, sourceDominant, context );
    mergeBuildBase_Resources( target, source, sourceDominant, context );
    mergeBuildBase_TestResources( target, source, sourceDominant, context );
    mergeBuildBase_Filters( target, source, sourceDominant, context );
}
项目:oceano    文件:ModelMerger.java   
protected void mergeBuildBase_DefaultGoal( BuildBase target, BuildBase source, boolean sourceDominant,
                                           Map<Object, Object> context )
{
    String src = source.getDefaultGoal();
    if ( src != null )
    {
        if ( sourceDominant || target.getDefaultGoal() == null )
        {
            target.setDefaultGoal( src );
            target.setLocation( "defaultGoal", source.getLocation( "defaultGoal" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeBuildBase_Directory( BuildBase target, BuildBase source, boolean sourceDominant,
                                         Map<Object, Object> context )
{
    String src = source.getDirectory();
    if ( src != null )
    {
        if ( sourceDominant || target.getDirectory() == null )
        {
            target.setDirectory( src );
            target.setLocation( "directory", source.getLocation( "directory" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeBuildBase_FinalName( BuildBase target, BuildBase source, boolean sourceDominant,
                                         Map<Object, Object> context )
{
    String src = source.getFinalName();
    if ( src != null )
    {
        if ( sourceDominant || target.getFinalName() == null )
        {
            target.setFinalName( src );
            target.setLocation( "finalName", source.getLocation( "finalName" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeBuildBase_Filters( BuildBase target, BuildBase source, boolean sourceDominant,
                                       Map<Object, Object> context )
{
    List<String> src = source.getFilters();
    if ( !src.isEmpty() )
    {
        List<String> tgt = target.getFilters();
        List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
        merged.addAll( tgt );
        merged.addAll( src );
        target.setFilters( merged );
    }
}
项目:oceano    文件:MavenModelMerger.java   
@Override
protected void mergeBuildBase_Resources( BuildBase target, BuildBase source, boolean sourceDominant,
                                         Map<Object, Object> context )
{
    if ( sourceDominant || target.getResources().isEmpty() )
    {
        super.mergeBuildBase_Resources( target, source, sourceDominant, context );
    }
}
项目:oceano    文件:MavenModelMerger.java   
@Override
protected void mergeBuildBase_TestResources( BuildBase target, BuildBase source, boolean sourceDominant,
                                             Map<Object, Object> context )
{
    if ( sourceDominant || target.getTestResources().isEmpty() )
    {
        super.mergeBuildBase_TestResources( target, source, sourceDominant, context );
    }
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public BuildBase replaceProfileBuild( BuildBase build )
{
    return build;
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public void visitProfileBuild( BuildBase build )
{
}
项目:xmvn    文件:DefaultModelProcessor.java   
private void visitProfileBuild( ModelVisitor visitor, BuildBase buildBase )
{
    List<Resource> resources = buildBase.getResources();
    if ( resources != null )
    {
        ListIterator<Resource> resourceIterator = resources.listIterator();
        while ( resourceIterator.hasNext() )
        {
            Resource resource = resourceIterator.next();
            visitor.visitProfileBuildResource( resource );
            visitProfileBuildResource( visitor, resource );
            resource = visitor.replaceProfileBuildResource( resource );
            if ( resource == null )
                resourceIterator.remove();
            else
                resourceIterator.set( resource );
        }
    }

    List<Resource> testResources = buildBase.getTestResources();
    if ( testResources != null )
    {
        ListIterator<Resource> testResourceIterator = testResources.listIterator();
        while ( testResourceIterator.hasNext() )
        {
            Resource testResource = testResourceIterator.next();
            visitor.visitProfileBuildTestResource( testResource );
            visitProfileBuildTestResource( visitor, testResource );
            testResource = visitor.replaceProfileBuildTestResource( testResource );
            if ( testResource == null )
                testResourceIterator.remove();
            else
                testResourceIterator.set( testResource );
        }
    }

    List<String> filters = buildBase.getFilters();
    if ( filters != null )
    {
        ListIterator<String> filterIterator = filters.listIterator();
        while ( filterIterator.hasNext() )
        {
            String filter = filterIterator.next();
            visitor.visitProfileBuildFilter( filter );
            filter = visitor.replaceProfileBuildFilter( filter );
            if ( filter == null )
                filterIterator.remove();
            else
                filterIterator.set( filter );
        }
    }

    PluginManagement pluginManagement = buildBase.getPluginManagement();
    if ( pluginManagement != null )
    {
        visitor.visitProfileBuildPluginManagement( pluginManagement );
        visitProfileBuildPluginManagement( visitor, pluginManagement );
        pluginManagement = visitor.replaceProfileBuildPluginManagement( pluginManagement );
        buildBase.setPluginManagement( pluginManagement );
    }

    List<Plugin> plugins = buildBase.getPlugins();
    if ( plugins != null )
    {
        ListIterator<Plugin> pluginIterator = plugins.listIterator();
        while ( pluginIterator.hasNext() )
        {
            Plugin plugin = pluginIterator.next();
            visitor.visitProfileBuildPlugin( plugin );
            visitProfileBuildPlugin( visitor, plugin );
            plugin = visitor.replaceProfileBuildPlugin( plugin );
            if ( plugin == null )
                pluginIterator.remove();
            else
                pluginIterator.set( plugin );
        }
    }
}
项目:oceano    文件:DefaultProfileInjector.java   
public void mergeBuildBase( BuildBase target, BuildBase source )
{
    mergeBuildBase( target, source, true, Collections.emptyMap() );
}
项目:xmvn    文件:ModelVisitor.java   
BuildBase replaceProfileBuild( BuildBase build );
项目:xmvn    文件:ModelVisitor.java   
void visitProfileBuild( BuildBase build );