Search in sources :

Example 21 with DependencyNode

use of org.apache.maven.shared.dependency.graph.DependencyNode in project maven-plugins by apache.

the class DependenciesReport method executeReport.

@Override
public void executeReport(Locale locale) {
    if (settings.isOffline() && dependencyLocationsEnabled) {
        getLog().warn("The parameter 'dependencyLocationsEnabled' is ignored in offline mode.");
        dependencyLocationsEnabled = false;
    }
    try {
        copyResources(new File(getOutputDirectory()));
    } catch (IOException e) {
        getLog().error("Cannot copy ressources", e);
    }
    @SuppressWarnings("unchecked") RepositoryUtils repoUtils = new RepositoryUtils(getLog(), wagonManager, settings, mavenProjectBuilder, factory, resolver, project.getRemoteArtifactRepositories(), project.getPluginArtifactRepositories(), localRepository, repositoryMetadataManager);
    DependencyNode dependencyNode = resolveProject();
    Dependencies dependencies = new Dependencies(project, dependencyNode, classesAnalyzer);
    DependenciesReportConfiguration config = new DependenciesReportConfiguration(dependencyDetailsEnabled, dependencyLocationsEnabled);
    DependenciesRenderer r = new DependenciesRenderer(getSink(), locale, getI18N(locale), getLog(), settings, dependencies, dependencyNode, config, repoUtils, artifactFactory, mavenProjectBuilder, remoteRepositories, localRepository);
    r.render();
}
Also used : RepositoryUtils(org.apache.maven.report.projectinfo.dependencies.RepositoryUtils) DependencyNode(org.apache.maven.shared.dependency.graph.DependencyNode) DependenciesReportConfiguration(org.apache.maven.report.projectinfo.dependencies.DependenciesReportConfiguration) IOException(java.io.IOException) Dependencies(org.apache.maven.report.projectinfo.dependencies.Dependencies) DependenciesRenderer(org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer) File(java.io.File)

Example 22 with DependencyNode

use of org.apache.maven.shared.dependency.graph.DependencyNode in project maven-plugins by apache.

the class DependenciesReport method canGenerateReport.

// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
@Override
public boolean canGenerateReport() {
    boolean result = super.canGenerateReport();
    if (result && skipEmptyReport) {
        // This seems to be a bit too much but the DependenciesRenderer applies the same logic
        DependencyNode dependencyNode = resolveProject();
        Dependencies dependencies = new Dependencies(project, dependencyNode, classesAnalyzer);
        result = dependencies.hasDependencies();
    }
    return result;
}
Also used : DependencyNode(org.apache.maven.shared.dependency.graph.DependencyNode) Dependencies(org.apache.maven.report.projectinfo.dependencies.Dependencies)

Example 23 with DependencyNode

use of org.apache.maven.shared.dependency.graph.DependencyNode in project fabric8 by fabric8io.

the class BuildMojo method collectClassPath.

private ArrayList<Artifact> collectClassPath() throws DependencyGraphBuilderException {
    ArtifactFilter filter = new ScopeArtifactFilter(scope);
    DependencyNode rootNode = dependencyGraphBuilder.buildDependencyGraph(project, filter);
    final ArrayList<Artifact> artifacts = new ArrayList<>();
    rootNode.accept(new DependencyNodeVisitor() {

        @Override
        public boolean visit(DependencyNode dependencyNode) {
            artifacts.add(dependencyNode.getArtifact());
            return true;
        }

        @Override
        public boolean endVisit(DependencyNode dependencyNode) {
            return true;
        }
    });
    return artifacts;
}
Also used : ArtifactFilter(org.apache.maven.artifact.resolver.filter.ArtifactFilter) ScopeArtifactFilter(org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter) ScopeArtifactFilter(org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter) DependencyNode(org.apache.maven.shared.dependency.graph.DependencyNode) ArrayList(java.util.ArrayList) Artifact(org.apache.maven.artifact.Artifact) DependencyNodeVisitor(org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor)

Aggregations

DependencyNode (org.apache.maven.shared.dependency.graph.DependencyNode)23 MavenProject (org.apache.maven.project.MavenProject)9 Artifact (org.apache.maven.artifact.Artifact)8 DependencyGraphBuilder (org.apache.maven.shared.dependency.graph.DependencyGraphBuilder)8 Builder (aQute.bnd.osgi.Builder)7 HashMap (java.util.HashMap)7 Properties (java.util.Properties)7 LinkedHashSet (java.util.LinkedHashSet)6 Map (java.util.Map)6 Manifest (java.util.jar.Manifest)6 File (java.io.File)5 Set (java.util.Set)5 TreeMap (java.util.TreeMap)5 ArrayList (java.util.ArrayList)4 ArtifactFilter (org.apache.maven.artifact.resolver.filter.ArtifactFilter)3 IOException (java.io.IOException)2 List (java.util.List)2 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)2 DefaultArtifactHandler (org.apache.maven.artifact.handler.DefaultArtifactHandler)2 AndArtifactFilter (org.apache.maven.artifact.resolver.filter.AndArtifactFilter)2