List of usage examples for org.apache.maven.model.profile ProfileActivationContext getInactiveProfileIds
List<String> getInactiveProfileIds();
From source file:com.github.sviperll.maven.profiledep.ActivatingProfileSelector.java
private ProfileActivationContext createProfileActivationContext(ProfileActivationContext source) { DefaultProfileActivationContext result = new DefaultProfileActivationContext(); result.setProjectDirectory(source.getProjectDirectory()); Properties projectProperties = new Properties(); projectProperties.putAll(source.getProjectProperties()); result.setProjectProperties(projectProperties); result.setSystemProperties(source.getSystemProperties()); result.setUserProperties(source.getUserProperties()); List<String> activeProfileIds = new ArrayList<String>(); activeProfileIds.addAll(source.getActiveProfileIds()); activeProfileIds.addAll(additionalProfileIDs); result.setActiveProfileIds(activeProfileIds); List<String> inactiveProfileIds = new ArrayList<String>(); inactiveProfileIds.addAll(source.getInactiveProfileIds()); inactiveProfileIds.addAll(additionallyExcludedProfileIDs); result.setInactiveProfileIds(inactiveProfileIds); return result; }
From source file:com.github.sviperll.maven.profiledep.ContextModifyingProfileSelector.java
private ProfileActivationContext createProfileActivationContext(ProfileActivationContext source) { DefaultProfileActivationContext result = new DefaultProfileActivationContext(); result.setProjectDirectory(source.getProjectDirectory()); Properties projectProperties = new Properties(); projectProperties.putAll(source.getProjectProperties()); result.setProjectProperties(projectProperties); result.setSystemProperties(source.getSystemProperties()); result.setUserProperties(source.getUserProperties()); List<String> activeProfileIds = new ArrayList<String>(); activeProfileIds.addAll(additionalProfileIDs); activeProfileIds.removeAll(source.getInactiveProfileIds()); activeProfileIds.addAll(source.getActiveProfileIds()); result.setActiveProfileIds(activeProfileIds); List<String> inactiveProfileIds = new ArrayList<String>(); inactiveProfileIds.addAll(additionallyExcludedProfileIDs); inactiveProfileIds.removeAll(source.getActiveProfileIds()); inactiveProfileIds.addAll(source.getInactiveProfileIds()); result.setInactiveProfileIds(inactiveProfileIds); return result; }
From source file:john.j.cool.maven.model.profile.AndActivationProfileSelector.java
License:Apache License
public List<Profile> getActiveProfiles(Collection<Profile> profiles, ProfileActivationContext context, ModelProblemCollector problems) { Collection<String> activatedIds = new HashSet<String>(context.getActiveProfileIds()); Collection<String> deactivatedIds = new HashSet<String>(context.getInactiveProfileIds()); List<Profile> activeProfiles = new ArrayList<Profile>(profiles.size()); List<Profile> activePomProfilesByDefault = new ArrayList<Profile>(); boolean activatedPomProfileNotByDefault = false; for (Profile profile : profiles) { if (!deactivatedIds.contains(profile.getId())) { if (activatedIds.contains(profile.getId()) || isActive(profile, context, problems)) { activeProfiles.add(profile); if (Profile.SOURCE_POM.equals(profile.getSource())) { activatedPomProfileNotByDefault = true; }//from ww w .j ava 2 s. c o m } else if (isActiveByDefault(profile)) { if (Profile.SOURCE_POM.equals(profile.getSource())) { activePomProfilesByDefault.add(profile); } else { activeProfiles.add(profile); } } } } if (!activatedPomProfileNotByDefault) { activeProfiles.addAll(activePomProfilesByDefault); } return activeProfiles; }
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();// w ww.j a v a 2 s. co m 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; }