Search in sources :

Example 21 with Dependency

use of org.apache.maven.model.Dependency in project maven-plugins by apache.

the class TestCopyMojo method getDependencyList.

public List<Dependency> getDependencyList(ArtifactItem item) {
    Dependency dep = new Dependency();
    dep.setArtifactId(item.getArtifactId());
    dep.setClassifier(item.getClassifier());
    dep.setGroupId(item.getGroupId());
    dep.setType(item.getType());
    dep.setVersion("2.0-SNAPSHOT");
    Dependency dep2 = new Dependency();
    dep2.setArtifactId(item.getArtifactId());
    dep2.setClassifier("classifier");
    dep2.setGroupId(item.getGroupId());
    dep2.setType(item.getType());
    dep2.setVersion("2.1");
    List<Dependency> list = new ArrayList<Dependency>(2);
    list.add(dep2);
    list.add(dep);
    return list;
}
Also used : ArrayList(java.util.ArrayList) Dependency(org.apache.maven.model.Dependency)

Example 22 with Dependency

use of org.apache.maven.model.Dependency in project maven-plugins by apache.

the class TestUnpackMojo method getDependencyList.

public List<Dependency> getDependencyList(ArtifactItem item) {
    Dependency dep = new Dependency();
    dep.setArtifactId(item.getArtifactId());
    dep.setClassifier(item.getClassifier());
    dep.setGroupId(item.getGroupId());
    dep.setType(item.getType());
    dep.setVersion("2.0-SNAPSHOT");
    Dependency dep2 = new Dependency();
    dep2.setArtifactId(item.getArtifactId());
    dep2.setClassifier("classifier");
    dep2.setGroupId(item.getGroupId());
    dep2.setType(item.getType());
    dep2.setVersion("2.1");
    List<Dependency> list = new ArrayList<Dependency>(2);
    list.add(dep2);
    list.add(dep);
    return list;
}
Also used : ArrayList(java.util.ArrayList) Dependency(org.apache.maven.model.Dependency)

Example 23 with Dependency

use of org.apache.maven.model.Dependency in project maven-plugins by apache.

the class TestUnpackMojo method createArtifacts.

// respects the createUnpackableFile flag of the ArtifactStubFactory
private List<Dependency> createArtifacts(List<Dependency> items) throws IOException {
    for (Dependency item : items) {
        String classifier = "".equals(item.getClassifier()) ? null : item.getClassifier();
        stubFactory.createArtifact(item.getGroupId(), item.getArtifactId(), VersionRange.createFromVersion(item.getVersion()), null, item.getType(), classifier, item.isOptional());
    }
    return items;
}
Also used : Dependency(org.apache.maven.model.Dependency)

Example 24 with Dependency

use of org.apache.maven.model.Dependency in project maven-plugins by apache.

the class DependencyConvergenceReport method generateConvergence.

/**
     * Generate the convergence table for all dependencies
     *
     * @param locale
     * @param sink
     * @param conflictingDependencyMap
     */
private void generateConvergence(Locale locale, Sink sink, DependencyAnalyzeResult result) {
    sink.section2();
    sink.sectionTitle2();
    if (isReactorBuild()) {
        sink.text(getI18nString(locale, "convergence.caption"));
    } else {
        sink.text(getI18nString(locale, "convergence.single.caption"));
    }
    sink.sectionTitle2_();
    // print conflicting dependencies
    for (Map.Entry<String, List<ReverseDependencyLink>> entry : result.getConflicting().entrySet()) {
        String key = entry.getKey();
        List<ReverseDependencyLink> depList = entry.getValue();
        sink.section3();
        sink.sectionTitle3();
        sink.text(key);
        sink.sectionTitle3_();
        generateDependencyDetails(locale, sink, depList);
        sink.section3_();
    }
    // print out snapshots jars
    for (ReverseDependencyLink dependencyLink : result.getSnapshots()) {
        sink.section3();
        sink.sectionTitle3();
        Dependency dep = dependencyLink.getDependency();
        sink.text(dep.getGroupId() + ":" + dep.getArtifactId());
        sink.sectionTitle3_();
        List<ReverseDependencyLink> depList = new ArrayList<ReverseDependencyLink>();
        depList.add(dependencyLink);
        generateDependencyDetails(locale, sink, depList);
        sink.section3_();
    }
    sink.section2_();
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Dependency(org.apache.maven.model.Dependency) HashMap(java.util.HashMap) DependencyVersionMap(org.apache.maven.report.projectinfo.dependencies.DependencyVersionMap) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 25 with Dependency

use of org.apache.maven.model.Dependency in project maven-plugins by apache.

the class ManagementDependencies method getManagementDependenciesByScope.

/**
     * @return the managementDependencies by scope
     * @see Artifact#SCOPE_COMPILE
     * @see Artifact#SCOPE_PROVIDED
     * @see Artifact#SCOPE_RUNTIME
     * @see Artifact#SCOPE_SYSTEM
     * @see Artifact#SCOPE_TEST
     */
public Map<String, List<Dependency>> getManagementDependenciesByScope() {
    Map<String, List<Dependency>> dependenciesByScope = new HashMap<String, List<Dependency>>();
    for (Dependency dependency : managementDependencies) {
        String scope = dependency.getScope() != null ? dependency.getScope() : Artifact.SCOPE_COMPILE;
        List<Dependency> multiValue = dependenciesByScope.get(scope);
        if (multiValue == null) {
            multiValue = new ArrayList<Dependency>();
        }
        multiValue.add(dependency);
        dependenciesByScope.put(scope, multiValue);
    }
    return dependenciesByScope;
}
Also used : HashMap(java.util.HashMap) List(java.util.List) ArrayList(java.util.ArrayList) Dependency(org.apache.maven.model.Dependency)

Aggregations

Dependency (org.apache.maven.model.Dependency)78 ArrayList (java.util.ArrayList)24 Artifact (org.apache.maven.artifact.Artifact)18 File (java.io.File)12 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)11 MavenProject (org.apache.maven.project.MavenProject)8 IOException (java.io.IOException)7 Exclusion (org.apache.maven.model.Exclusion)7 MojoFailureException (org.apache.maven.plugin.MojoFailureException)7 WebappStructure (org.apache.maven.plugins.war.util.WebappStructure)7 HashMap (java.util.HashMap)6 DependencyManagement (org.apache.maven.model.DependencyManagement)5 Model (org.apache.maven.model.Model)5 Test (org.junit.Test)5 HashSet (java.util.HashSet)4 Map (java.util.Map)4 Plugin (org.apache.maven.model.Plugin)4 List (java.util.List)3 Properties (java.util.Properties)3 ArtifactFilter (org.apache.maven.artifact.resolver.filter.ArtifactFilter)3