Search in sources :

Example 11 with Exclusion

use of org.apache.maven.model.Exclusion in project gradle by gradle.

the class MavenPomFileGenerator method addDependency.

private void addDependency(MavenDependencyInternal dependency, String artifactId, String scope, String type, String classifier) {
    Dependency mavenDependency = new Dependency();
    mavenDependency.setGroupId(dependency.getGroupId());
    mavenDependency.setArtifactId(artifactId);
    mavenDependency.setVersion(mapToMavenSyntax(dependency.getVersion()));
    mavenDependency.setType(type);
    mavenDependency.setScope(scope);
    mavenDependency.setClassifier(classifier);
    for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(GUtil.elvis(excludeRule.getGroup(), "*"));
        exclusion.setArtifactId(GUtil.elvis(excludeRule.getModule(), "*"));
        mavenDependency.addExclusion(exclusion);
    }
    getModel().addDependency(mavenDependency);
}
Also used : Exclusion(org.apache.maven.model.Exclusion) MavenDependency(org.gradle.api.publish.maven.MavenDependency) Dependency(org.apache.maven.model.Dependency) ExcludeRule(org.gradle.api.artifacts.ExcludeRule)

Aggregations

Exclusion (org.apache.maven.model.Exclusion)11 Dependency (org.apache.maven.model.Dependency)7 Artifact (org.apache.maven.artifact.Artifact)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 ArtifactFilter (org.apache.maven.artifact.resolver.filter.ArtifactFilter)2 ExcludesArtifactFilter (org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter)2 InvalidVersionSpecificationException (org.apache.maven.artifact.versioning.InvalidVersionSpecificationException)2 VersionRange (org.apache.maven.artifact.versioning.VersionRange)2 DependencyManagement (org.apache.maven.model.DependencyManagement)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 ExecutableDependency (org.codehaus.mojo.exec.ExecutableDependency)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 XPath (javax.xml.xpath.XPath)1 XPathExpression (javax.xml.xpath.XPathExpression)1 ScopeArtifactFilter (org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter)1 AnalyzeDepMgt (org.apache.maven.plugins.dependency.analyze.AnalyzeDepMgt)1