use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomProfile in project gradle by gradle.
the class PomReader method parseActivePomProfiles.
/**
* Parses all active profiles that can be found in POM.
*
* @return Active POM profiles
*/
private List<PomProfile> parseActivePomProfiles() {
if (declaredActivePomProfiles == null) {
List<PomProfile> activeByDefaultPomProfiles = new ArrayList<PomProfile>();
List<PomProfile> activeByAbsenceOfPropertyPomProfiles = new ArrayList<PomProfile>();
Element profilesElement = getFirstChildElement(projectElement, PROFILES);
if (profilesElement != null) {
for (Element profileElement : getAllChilds(profilesElement)) {
if (PROFILE.equals(profileElement.getNodeName())) {
Element activationElement = getFirstChildElement(profileElement, PROFILE_ACTIVATION);
if (activationElement != null) {
String activeByDefault = getFirstChildText(activationElement, PROFILE_ACTIVATION_ACTIVE_BY_DEFAULT);
if (activeByDefault != null && "true".equals(activeByDefault)) {
activeByDefaultPomProfiles.add(new PomProfileElement(profileElement));
} else {
Element propertyElement = getFirstChildElement(activationElement, PROFILE_ACTIVATION_PROPERTY);
if (propertyElement != null) {
if (isActivationPropertyActivated(propertyElement)) {
activeByAbsenceOfPropertyPomProfiles.add(new PomProfileElement(profileElement));
}
}
}
}
}
}
}
declaredActivePomProfiles = determineActiveProfiles(activeByDefaultPomProfiles, activeByAbsenceOfPropertyPomProfiles);
}
return declaredActivePomProfiles;
}
use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomProfile in project gradle by gradle.
the class PomReader method parseDependencyMgt.
/**
* Parses the dependency management elements declared in this POM without removing the duplicates.
*
* @return Parsed dependency management elements
*/
public List<PomDependencyMgt> parseDependencyMgt() {
if (declaredDependencyMgts == null) {
List<PomDependencyMgt> dependencyMgts = getDependencyMgt(projectElement);
for (PomProfile pomProfile : parseActivePomProfiles()) {
for (PomDependencyMgt dependencyMgt : pomProfile.getDependencyMgts()) {
dependencyMgts.add(dependencyMgt);
}
}
declaredDependencyMgts = dependencyMgts;
}
return declaredDependencyMgts;
}
Aggregations