List of usage examples for org.apache.maven.model.profile.activation ProfileActivator isActive
boolean isActive(Profile profile, ProfileActivationContext context, ModelProblemCollector problems);
From source file:john.j.cool.maven.model.profile.AndActivationProfileSelector.java
License:Apache License
private boolean isActive(Profile profile, ProfileActivationContext context, ModelProblemCollector problems) { List<ProfileActivator> activators = getActivatorsByProfile(profile); boolean active = !activators.isEmpty(); for (ProfileActivator activator : activators) { try {/*from ww w. j av a 2s .com*/ active = activator.isActive(profile, context, problems); if (!active) { break; } } catch (RuntimeException e) { problems.add(Severity.ERROR, "Failed to determine activation for profile " + profile.getId(), profile.getLocation(""), e); return false; } } return active; }
From source file:org.jboss.shrinkwrap.resolver.impl.maven.internal.SettingsXmlProfileSelector.java
License:Apache License
@Override public List<Profile> getActiveProfiles(Collection<Profile> profiles, ProfileActivationContext context, ModelProblemCollector problems) { List<Profile> activeProfiles = new ArrayList<Profile>(); for (Profile p : profiles) { String id = p.getId();/*from ww w. j a v a 2 s .com*/ if (p.getId() != null && context.getActiveProfileIds().contains(id) && !context.getInactiveProfileIds().contains(id)) { activeProfiles.add(p); } if (p.getActivation() != null && p.getActivation().isActiveByDefault() && !context.getInactiveProfileIds().contains(p.getId())) { activeProfiles.add(p); break; } for (ProfileActivator activator : activators) { if (activator.isActive(p, context, problems)) { activeProfiles.add(p); break; } } } return activeProfiles; }