Search in sources :

Example 1 with PomDependencyMgt

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt in project gradle by gradle.

the class GradlePomModuleDescriptorBuilder method getDefaultScope.

private String getDefaultScope(PomDependencyData dep) {
    PomDependencyMgt pomDependencyMgt = findDependencyDefault(dep);
    String result = null;
    if (pomDependencyMgt != null) {
        result = pomDependencyMgt.getScope();
    }
    if ((result == null) || !SCOPES.containsKey(result)) {
        result = "compile";
    }
    return result;
}
Also used : PomDependencyMgt(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt)

Example 2 with PomDependencyMgt

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt in project gradle by gradle.

the class GradlePomModuleDescriptorBuilder method getDefaultScope.

private String getDefaultScope(PomDependencyMgt dep) {
    PomDependencyMgt pomDependencyMgt = findDependencyDefault(dep);
    String result = null;
    if (pomDependencyMgt != null) {
        result = pomDependencyMgt.getScope();
    }
    if ((result == null) || !SCOPES.containsKey(result)) {
        result = "compile";
    }
    return result;
}
Also used : PomDependencyMgt(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt)

Example 3 with PomDependencyMgt

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt in project gradle by gradle.

the class GradlePomModuleDescriptorParser method parseImportedDependencyMgts.

/**
 * Parses imported dependency management information.
 *
 * @param parseContext          Parse context
 * @param currentDependencyMgts Current dependency management information
 * @return Imported dependency management information
 * @throws IOException
 * @throws SAXException
 */
private Map<MavenDependencyKey, PomDependencyMgt> parseImportedDependencyMgts(DescriptorParseContext parseContext, Collection<PomDependencyMgt> currentDependencyMgts) throws IOException, SAXException {
    Map<MavenDependencyKey, PomDependencyMgt> importedDependencyMgts = new LinkedHashMap<MavenDependencyKey, PomDependencyMgt>();
    for (PomDependencyMgt currentDependencyMgt : currentDependencyMgts) {
        if (isDependencyImportScoped(currentDependencyMgt)) {
            ModuleComponentSelector importedId = DefaultModuleComponentSelector.newSelector(currentDependencyMgt.getGroupId(), currentDependencyMgt.getArtifactId(), new DefaultMutableVersionConstraint(currentDependencyMgt.getVersion()));
            PomReader importedPom = parsePomForSelector(parseContext, importedId, Maps.<String, String>newHashMap());
            for (Map.Entry<MavenDependencyKey, PomDependencyMgt> entry : importedPom.getDependencyMgt().entrySet()) {
                if (!importedDependencyMgts.containsKey(entry.getKey())) {
                    importedDependencyMgts.put(entry.getKey(), entry.getValue());
                }
            }
        }
    }
    return importedDependencyMgts;
}
Also used : ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) DefaultMutableVersionConstraint(org.gradle.api.internal.artifacts.dependencies.DefaultMutableVersionConstraint) PomDependencyMgt(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) MavenDependencyKey(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with PomDependencyMgt

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt in project gradle by gradle.

the class PomReader method resolveDependencyMgt.

private Map<MavenDependencyKey, PomDependencyMgt> resolveDependencyMgt() {
    Map<MavenDependencyKey, PomDependencyMgt> dependencies = new LinkedHashMap<MavenDependencyKey, PomDependencyMgt>();
    dependencies.putAll(pomParent.getDependencyMgt());
    dependencies.putAll(importedDependencyMgts);
    for (PomDependencyMgt dependencyMgt : parseDependencyMgt()) {
        dependencies.put(dependencyMgt.getId(), dependencyMgt);
    }
    return dependencies;
}
Also used : PomDependencyMgt(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt) MavenDependencyKey(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey) LinkedHashMap(java.util.LinkedHashMap)

Example 5 with PomDependencyMgt

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt 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;
}
Also used : PomDependencyMgt(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt) PomProfile(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomProfile)

Aggregations

PomDependencyMgt (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt)6 LinkedHashMap (java.util.LinkedHashMap)2 MavenDependencyKey (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)1 DefaultMutableVersionConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultMutableVersionConstraint)1 PomProfile (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomProfile)1 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1