org.apache.maven.model.BuildBase Java Examples

The following examples show how to use org.apache.maven.model.BuildBase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CheckPluginDependencyVersions.java    From unleash-maven-plugin with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: CheckPluginDependencyVersions.java    From unleash-maven-plugin with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: DistributionEnforcingManipulator.java    From pom-manipulation-ext with Apache License 2.0 6 votes vote down vote up
private 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;
}
 
Example #4
Source File: CheckPluginVersions.java    From unleash-maven-plugin with Eclipse Public License 1.0 5 votes vote down vote up
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();
}
 
Example #5
Source File: CheckPluginVersions.java    From unleash-maven-plugin with Eclipse Public License 1.0 5 votes vote down vote up
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();
}
 
Example #6
Source File: DistributionEnforcingManipulatorTest.java    From pom-manipulation-ext with Apache License 2.0 5 votes vote down vote up
private void assertSkip( final Model model, final String profileId )
{
    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, true ? MAVEN_DEPLOY_ARTIFACTID : MAVEN_INSTALL_ARTIFACTID ) );

    assertThat( plugin, notNullValue() );

    assertThat( plugin.getConfiguration()
                      .toString()
                      .contains( "<skip>" + Boolean.FALSE + "</skip>" ), equalTo( true ) );
}