Java Code Examples for org.apache.maven.model.Profile

The following examples show how to use org.apache.maven.model.Profile. These examples are extracted from open source projects. 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
public void execute() throws MojoExecutionException {
    getLog().debug("Start building");

    // prepare the execution:
    final InvocationRequest invocationRequest = new DefaultInvocationRequest();
    invocationRequest.setProfiles(project.getActiveProfiles().stream()
            .map(Profile::getId)
            .collect(Collectors.toList()));
    invocationRequest.setPomFile(new File(pom));

    invocationRequest.setGoals(Arrays.asList("client:compile", "client:link"));

    final Invoker invoker = new DefaultInvoker();
    // execute:
    try {
        final InvocationResult invocationResult = invoker.execute(invocationRequest);
        if (invocationResult.getExitCode() != 0) {
            throw new MojoExecutionException("Error, client:build failed", invocationResult.getExecutionException());
        }
    } catch (MavenInvocationException e) {
        e.printStackTrace();
        throw new MojoExecutionException("Error", e);
    }

}
 
Example 2
Source Project: quarkus   Source File: MavenModelBuilder.java    License: Apache License 2.0 6 votes vote down vote up
private void completeWorkspaceProjectBuildRequest(ModelBuildingRequest request) {
    final Set<String> addedProfiles = new HashSet<>();
    final List<Profile> profiles = request.getProfiles();
    profiles.forEach(p -> addedProfiles.add(p.getId()));

    activeSettingsProfiles.forEach(p -> {
        if (!addedProfiles.contains(p.getId())) {
            profiles.add(p);
            request.getActiveProfileIds().add(p.getId());
        }
    });

    request.getActiveProfileIds().addAll(mvnOptions.getActiveProfileIds());
    request.getInactiveProfileIds().addAll(mvnOptions.getInactiveProfileIds());
    request.setUserProperties(System.getProperties());
}
 
Example 3
Source Project: netbeans   Source File: NBModelBuilder.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ModelBuildingResult build(ModelBuildingRequest request) throws ModelBuildingException {
    ModelBuildingResult toRet = super.build(request);
    Model eff = toRet.getEffectiveModel();
    InputSource source = new InputSource();
    source.setLocation("");
    InputLocation location = new InputLocation(-1, -1, source);
    eff.setLocation(NETBEANS_PROFILES, location);
    for (String id : toRet.getModelIds()) {
        Model mdl = toRet.getRawModel(id);
        for (Profile p : mdl.getProfiles()) {
            source.setLocation(source.getLocation() + "|" + p.getId());
        }
    }
    return toRet;
}
 
Example 4
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 5
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 6
/** {@inheritDoc} */
public void execute()
    throws MojoExecutionException
{
    validateOutputFile();
    List<?> list = getProject().getActiveProfiles();
    if ( getLog().isInfoEnabled() )
    {
        getLog().debug( list.size() + " profile(s) active" );
    }
    Properties properties = new Properties();
    for ( Iterator<?> iter = list.iterator(); iter.hasNext(); )
    {
        Profile profile = (Profile) iter.next();
        if ( profile.getProperties() != null )
        {
            properties.putAll( profile.getProperties() );
        }
    }

    writeProperties( properties, getOutputFile() );
}
 
Example 7
Source Project: pom-manipulation-ext   Source File: Project.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This method will scan the dependencies in the potentially active Profiles in this project and
 * return a fully resolved list.  Note that this will only return full dependencies not managed
 * i.e. those with a group, artifact and version.
 *
 * 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}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile, Map<ArtifactRef, Dependency>> getResolvedProfileDependencies( MavenSessionHandler session) throws ManipulationException
{
    Map<Profile, Map<ArtifactRef, Dependency>> resolvedProfileDependencies = new HashMap<>();

    for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
    {
        Map<ArtifactRef, Dependency> profileDeps = new HashMap<>();

        resolveDeps( session, profile.getDependencies(), false, profileDeps );

        resolvedProfileDependencies.put( profile, profileDeps );
    }

    return resolvedProfileDependencies;
}
 
Example 8
Source Project: pom-manipulation-ext   Source File: Project.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This method will scan the dependencies in the potentially active Profiles in this project and
 * return a fully resolved list. Note that this will return all dependencies including managed
 * i.e. those with a group, artifact and potentially empty version.
 *
 * 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}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile, Map<ArtifactRef, Dependency>> getAllResolvedProfileDependencies( MavenSessionHandler session) throws ManipulationException
{
    Map<Profile, Map<ArtifactRef, Dependency>> allResolvedProfileDependencies = new HashMap<>();

    for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
    {
        Map<ArtifactRef, Dependency> profileDeps = new HashMap<>();

        resolveDeps( session, profile.getDependencies(), true, profileDeps );

        allResolvedProfileDependencies.put( profile, profileDeps );
    }

    return allResolvedProfileDependencies;
}
 
Example 9
Source Project: pom-manipulation-ext   Source File: Project.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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 Map<Profile, Map<ArtifactRef, Dependency>> getResolvedProfileManagedDependencies( MavenSessionHandler session) throws ManipulationException
{
    Map<Profile, Map<ArtifactRef, Dependency>> resolvedProfileManagedDependencies = new HashMap<>();

    for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
    {
        Map<ArtifactRef, Dependency> profileDeps = new HashMap<>();

        final DependencyManagement dm = profile.getDependencyManagement();

        if ( dm != null )
        {
            resolveDeps( session, dm.getDependencies(), false, profileDeps );
        }

        resolvedProfileManagedDependencies.put( profile, profileDeps );
    }
    return resolvedProfileManagedDependencies;
}
 
Example 10
Source Project: pom-manipulation-ext   Source File: Project.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This method will scan the plugins in the potentially active Profiles in this project and
 * return a fully resolved list. Note that while updating the {@link Plugin} 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 ProjectVersionRef} to the original {@link Plugin}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile,Map<ProjectVersionRef,Plugin>> getResolvedProfilePlugins( MavenSessionHandler session )
                throws ManipulationException
{
    Map<Profile, Map<ProjectVersionRef, Plugin>> resolvedProfilePlugins = new HashMap<>();

    for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
    {
        Map<ProjectVersionRef, Plugin> profileDeps = new HashMap<>();

        if ( profile.getBuild() != null )
        {
            resolvePlugins( session, profile.getBuild().getPlugins(), PluginResolver.NONE, profileDeps );

        }
        resolvedProfilePlugins.put( profile, profileDeps );
    }

    return resolvedProfilePlugins;
}
 
Example 11
Source Project: pom-manipulation-ext   Source File: Project.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This method will scan the plugins in the potentially active Profiles in this project including those without a
 * version and return a fully resolved list. Note that while updating the {@link Plugin} 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 ProjectVersionRef} to the original {@link Plugin}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile,Map<ProjectVersionRef,Plugin>> getAllResolvedProfilePlugins( MavenSessionHandler session )
                throws ManipulationException
{
    Map<Profile, Map<ProjectVersionRef, Plugin>> allResolvedProfilePlugins = new HashMap<>();

    for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
    {
        Map<ProjectVersionRef, Plugin> profileDeps = new HashMap<>();

        if ( profile.getBuild() != null )
        {
            resolvePlugins( session, profile.getBuild().getPlugins(), PluginResolver.ALL, profileDeps );

        }
        allResolvedProfilePlugins.put( profile, profileDeps );
    }

    return allResolvedProfilePlugins;
}
 
Example 12
Source Project: pom-manipulation-ext   Source File: Project.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This method will scan the plugins in the pluginManagement section in the potentially active Profiles
 * in this project and return a fully resolved list. Note that while updating the {@link Plugin}
 * 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 ProjectVersionRef} to the original {@link Plugin}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile,Map<ProjectVersionRef,Plugin>> getResolvedProfileManagedPlugins( MavenSessionHandler session )
                throws ManipulationException
{
    Map<Profile, Map<ProjectVersionRef, Plugin>> resolvedProfileManagedPlugins = new HashMap<>();

    for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
    {
        Map<ProjectVersionRef, Plugin> profileDeps = new HashMap<>();

        if ( profile.getBuild() != null )
        {
            final PluginManagement pm = profile.getBuild().getPluginManagement();

            if ( pm != null )
            {
                resolvePlugins( session, pm.getPlugins(), PluginResolver.PLUGIN_DEFAULTS, profileDeps );
            }
        }
        resolvedProfileManagedPlugins.put( profile, profileDeps );
    }
    return resolvedProfileManagedPlugins;
}
 
Example 13
Source Project: pom-manipulation-ext   Source File: ProfileUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static List<Profile> getProfiles ( MavenSessionHandler session, Model model)
{
    final List<Profile> result = new ArrayList<>( );
    final List<Profile> profiles = model.getProfiles();
    final boolean scanActiveProfiles = Boolean.parseBoolean( session.getUserProperties().getProperty( PROFILE_SCANNING, PROFILE_SCANNING_DEFAULT ) );

    if ( profiles != null )
    {
        if ( scanActiveProfiles )
        {
            for ( Profile p : profiles )
            {
                if ( session.getActiveProfiles().contains( p.getId() ) )
                {
                    result.add( p );
                }
            }
        }
        else
        {
            result.addAll( profiles );
        }
    }
    return result;
}
 
Example 14
private boolean apply( final Project project, final Model model )
{
    final PluginRemovalState state = session.getState( PluginRemovalState.class );

    if (logger.isDebugEnabled())
    {
        logger.debug( "Applying plugin changes to: {}", ga( project ) );
    }


    boolean result = false;
    List<ProjectRef> pluginsToRemove = state.getPluginRemoval();
    if ( model.getBuild() != null )
    {
        result = scanPlugins( pluginsToRemove, model.getBuild().getPlugins() );
    }

    for ( final Profile profile : ProfileUtils.getProfiles( session, model) )
    {
        if ( profile.getBuild() != null && scanPlugins( pluginsToRemove, profile.getBuild().getPlugins() ) )
        {
            result = true;
        }
    }
    return result;
}
 
Example 15
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 16
Source Project: quarkus   Source File: MavenModelBuilder.java    License: Apache License 2.0 5 votes vote down vote up
public MavenModelBuilder(WorkspaceModelResolver wsModelResolver, BootstrapMavenOptions mvnOptions,
        List<Profile> activeSettingsProfiles) {
    builder = new BootstrapModelBuilderFactory().newInstance();
    workspaceResolver = wsModelResolver;
    this.activeSettingsProfiles = activeSettingsProfiles;
    this.mvnOptions = mvnOptions;
}
 
Example 17
Source Project: quarkus   Source File: TsArtifact.java    License: Apache License 2.0 5 votes vote down vote up
public TsArtifact addProfile(Profile profile) {
    if (pomProfiles.isEmpty()) {
        pomProfiles = new ArrayList<>(1);
    }
    pomProfiles.add(profile);
    return this;
}
 
Example 18
Source Project: quarkus   Source File: DependencyAddedInProfileTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected TsArtifact modelApp() {

    final TsQuarkusExt extA_100 = new TsQuarkusExt("ext-a", "1.0.0");
    addToExpectedLib(extA_100.getRuntime());

    final TsQuarkusExt extB_100 = new TsQuarkusExt("ext-b", "1.0.0");
    install(extB_100);
    final TsArtifact extB_100_rt = extB_100.getRuntime();
    addToExpectedLib(extB_100_rt);

    final TsArtifact appJar = TsArtifact.jar("app")
            .addDependency(extA_100);

    final Profile profile = new Profile();
    profile.setId("extra");
    Activation activation = new Activation();
    ActivationProperty ap = new ActivationProperty();
    ap.setName("extra");
    activation.setProperty(ap);
    profile.setActivation(activation);
    final Dependency dep = new Dependency();
    dep.setGroupId(extB_100_rt.getGroupId());
    dep.setArtifactId(extB_100_rt.getArtifactId());
    dep.setVersion(extB_100_rt.getVersion());
    profile.addDependency(dep);
    appJar.addProfile(profile);

    createWorkspace();

    setSystemProperty("extra", "extra");

    return appJar;
}
 
Example 19
@Override
public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) {

    String serverName = options.get("server").getSingleValue();
    // From MP 3.2 on with Helidon, one of the Maven deps changed
    // So I created a new profile with correct naming.  The solution with the MP version in the profile name is not really useful in this case
    // since it will be for several MP releases.
    if ("helidon".equals(serverName) && model.getSpecification().getMicroProfileVersion().ordinal() <= MicroProfileVersion.MP32.ordinal()) {
        serverName = "helidon2";
    }
    String profileName = serverName + "-" + model.getSpecification().getMicroProfileVersion().getCode();

    Profile profile = findProfile(profileName);
    if (profile == null) {
        profile = findProfile(serverName);
    }

    if (profile == null) {
        throw new JessieUnexpectedException("Profile not found " + profileName);
    }

    Profile selectedProfile = profile.clone();
    selectedProfile.setId(serverName);
    Activation activeByDefault = new Activation();
    activeByDefault.setActiveByDefault(true);
    selectedProfile.setActivation(activeByDefault);
    pomFile.getProfiles().add(selectedProfile);

    if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH) && mainProject) {
        mavenHelper.addDependency(pomFile, "io.vertx", "vertx-auth-jwt", VERTX_JWT_VERSION);
    }

    if (model.hasMainAndSecondaryProject()) {
        if (mainProject) {
            pomFile.setArtifactId(model.getMaven().getArtifactId() + "-" + JessieModel.MAIN_INDICATOR);
        } else {
            pomFile.setArtifactId(model.getMaven().getArtifactId() + "-" + JessieModel.SECONDARY_INDICATOR);
        }
    }
}
 
Example 20
private Profile findProfile(String profileName) {
    Profile result = null;

    for (Profile profile : serverPomModel.getProfiles()) {
        if (profile.getId().equals(profileName)) {
            result = profile;
        }
    }
    return result;
}
 
Example 21
Source Project: microprofile-starter   Source File: TomeeServer.java    License: Apache License 2.0 5 votes vote down vote up
private void adjustPOM(Model pomFile, JessieModel model, boolean mainProject) {
    Profile profile = pomFile.getProfiles().get(0);// We assume there is only 1 profile.
    Plugin mavenPlugin = findMavenPlugin(profile.getBuild().getPlugins());
    Xpp3Dom configuration = (Xpp3Dom) mavenPlugin.getConfiguration();

    Xpp3Dom httpPort = new Xpp3Dom("tomeeHttpPort");
    httpPort.setValue(
            mainProject ? SupportedServer.TOMEE.getPortServiceA() : SupportedServer.TOMEE.getPortServiceB()
    );
    configuration.addChild(httpPort);

    Xpp3Dom shutdownPort = new Xpp3Dom("tomeeShutdownPort");
    shutdownPort.setValue(
            mainProject ? "8005" : "8105"
    );
    configuration.addChild(shutdownPort);

    Xpp3Dom ajpPort = new Xpp3Dom("tomeeAjpPort");
    ajpPort.setValue(
            mainProject ? "8009" : "8109"
    );
    configuration.addChild(ajpPort);

    List<MicroprofileSpec> microprofileSpecs = model.getParameter(JessieModel.Parameter.MICROPROFILESPECS);
    if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH) && !mainProject) {
        Xpp3Dom systemVariables = new Xpp3Dom("systemVariables");
        Xpp3Dom publicKeyLocation = new Xpp3Dom("mp.jwt.verify.publickey.location");
        publicKeyLocation.setValue("/publicKey.pem");
        systemVariables.addChild(publicKeyLocation);
        configuration.addChild(systemVariables);
    }

}
 
Example 22
Source Project: netbeans   Source File: ProjectProfileHandlerImpl.java    License: Apache License 2.0 5 votes vote down vote up
public @Override List<String> getAllProfiles() {
    lazyInit();
    Set<String> profileIds = new HashSet<String>();
    //pom profiles come first
    extractProfiles(profileIds);
    //Add settings file Properties
    profileIds.addAll(NbCollections.checkedMapByFilter(EmbedderFactory.getProjectEmbedder().getSettings().getProfilesAsMap(), String.class, org.apache.maven.settings.Profile.class, true).keySet());

    return new ArrayList<String>(profileIds);
}
 
Example 23
Source Project: neoscada   Source File: DefaultPomHelper.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected List<String> getModules ( final MavenProject project )
{
    final List<String> result = new LinkedList<String> ();

    result.addAll ( project.getModules () );
    for ( final Profile profile : project.getModel ().getProfiles () )
    {
        result.addAll ( profile.getModules () );
    }

    return result;
}
 
Example 24
Source Project: fabric8-forge   Source File: MavenHelpers.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the profile for the given id or null if it could not be found
 */
public static Profile findProfile(Model mavenModel, String profileId) {
    List<Profile> profiles = mavenModel.getProfiles();
    if (profiles != null) {
        for (Profile profile : profiles) {
            if (Objects.equal(profile.getId(), profileId)) {
                return profile;
            }
        }
    }
    return null;
}
 
Example 25
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromAllProfiles(MavenProject project,
    PomPropertyResolver propertyResolver) {
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  List<Profile> profiles = project.getModel().getProfiles();
  if (profiles != null) {
    for (Profile profile : profiles) {
      result.putAll(getSnapshotsFromManagement(profile, propertyResolver));
      result.putAll(getSnapshots(profile, propertyResolver));
    }
  }
  return result;
}
 
Example 26
private Set<ArtifactCoordinates> getSnapshotsFromAllProfiles(MavenProject project,
    PomPropertyResolver propertyResolver) {
  Set<ArtifactCoordinates> snapshots = Sets.newHashSet();
  List<Profile> profiles = project.getModel().getProfiles();
  if (profiles != null) {
    for (Profile profile : profiles) {
      snapshots.addAll(getSnapshotsFromManagement(profile, propertyResolver));
      snapshots.addAll(getSnapshots(profile, propertyResolver));
    }
  }
  return snapshots;
}
 
Example 27
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 28
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 29
private Set<ArtifactCoordinates> getSnapshotsFromAllProfiles(MavenProject project,
    PomPropertyResolver propertyResolver) {
  Set<ArtifactCoordinates> snapshots = Sets.newHashSet();
  List<Profile> profiles = project.getModel().getProfiles();
  if (profiles != null) {
    for (Profile profile : profiles) {
      snapshots.addAll(getSnapshotsFromManagement(profile, propertyResolver));
      snapshots.addAll(getSnapshots(profile, propertyResolver));
    }
  }
  filterMultiModuleDependencies(snapshots);
  return snapshots;
}
 
Example 30
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();
}