Search in sources :

Example 1 with Builder

use of org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships.Builder in project galley by Commonjava.

the class MavenModelProcessor method readRelationships.

public EProjectDirectRelationships readRelationships(final MavenPomView pomView, final URI source, final ModelProcessorConfig discoveryConfig) throws GalleyMavenException {
    final boolean includeManagedDependencies = discoveryConfig.isIncludeManagedDependencies();
    final boolean includeBuildSection = discoveryConfig.isIncludeBuildSection();
    final boolean includeManagedPlugins = discoveryConfig.isIncludeManagedPlugins();
    logger.info("Reading relationships for: {}\n  (from: {})", pomView.getRef(), source);
    try {
        final ProjectVersionRef projectRef = pomView.getRef();
        final EProjectDirectRelationships.Builder builder = new EProjectDirectRelationships.Builder(source, projectRef);
        addParentRelationship(source, builder, pomView, projectRef);
        addDependencyRelationships(source, builder, pomView, projectRef, includeManagedDependencies);
        if (includeBuildSection) {
            addExtensionUsages(source, builder, pomView, projectRef);
            addPluginUsages(source, builder, pomView, projectRef, includeManagedPlugins);
        }
        return builder.build();
    } catch (final InvalidVersionSpecificationException e) {
        throw new GalleyMavenException("Failed to parse version for model: {}. Reason: {}", e, pomView, e.getMessage());
    } catch (final IllegalArgumentException e) {
        throw new GalleyMavenException("Failed to parse relationships for model: {}. Reason: {}", e, pomView, e.getMessage());
    }
}
Also used : Builder(org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships.Builder) GalleyMavenException(org.commonjava.maven.galley.maven.GalleyMavenException) InvalidVersionSpecificationException(org.commonjava.maven.atlas.ident.version.InvalidVersionSpecificationException) ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) Builder(org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships.Builder) EProjectDirectRelationships(org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships)

Aggregations

EProjectDirectRelationships (org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships)1 Builder (org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships.Builder)1 ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)1 InvalidVersionSpecificationException (org.commonjava.maven.atlas.ident.version.InvalidVersionSpecificationException)1 GalleyMavenException (org.commonjava.maven.galley.maven.GalleyMavenException)1