Search in sources :

Example 1 with SimplePluginDependencyRelationship

use of org.commonjava.maven.atlas.graph.rel.SimplePluginDependencyRelationship in project galley by Commonjava.

the class MavenModelProcessor method addPluginDependencies.

private void addPluginDependencies(final Collection<PluginDependencyView> pluginDependencies, final PluginView plugin, final ProjectVersionRef pluginRef, final ProjectVersionRef projectRef, final Builder builder, final URI source, final boolean managed) {
    if (pluginDependencies != null) {
        for (final PluginDependencyView dep : pluginDependencies) {
            try {
                final ProjectVersionRef ref = dep.asProjectVersionRef();
                final String profileId = dep.getProfileId();
                final URI location = RelationshipUtils.profileLocation(profileId);
                final ArtifactRef artifactRef = new SimpleArtifactRef(ref, dep.getType(), dep.getClassifier());
                // force the InvalidVersionSpecificationException.
                artifactRef.getVersionSpec();
                boolean inherited = dep.getOriginInfo().isInherited();
                boolean mixin = dep.getOriginInfo().isMixin();
                builder.withPluginDependencies(new SimplePluginDependencyRelationship(source, location, projectRef, pluginRef, artifactRef, builder.getNextPluginDependencyIndex(pluginRef, managed, inherited), managed, inherited));
            } catch (final InvalidRefException e) {
                logger.error(String.format("%s: plugin dependency is invalid in: %s! Reason: %s. Skipping:\n\n%s\n\n", projectRef, pluginRef, e.getMessage(), dep.toXML()), e);
            } catch (final InvalidVersionSpecificationException e) {
                logger.error(String.format("%s: plugin dependency is invalid in: %s! Reason: %s. Skipping:\n\n%s\n\n", projectRef, pluginRef, e.getMessage(), dep.toXML()), e);
            } catch (final GalleyMavenException e) {
                logger.error(String.format("%s: plugin dependency is invalid in: %s! Reason: %s. Skipping:\n\n%s\n\n", projectRef, pluginRef, e.getMessage(), dep.toXML()), e);
            }
        }
    }
}
Also used : PluginDependencyView(org.commonjava.maven.galley.maven.model.view.PluginDependencyView) SimplePluginDependencyRelationship(org.commonjava.maven.atlas.graph.rel.SimplePluginDependencyRelationship) GalleyMavenException(org.commonjava.maven.galley.maven.GalleyMavenException) InvalidVersionSpecificationException(org.commonjava.maven.atlas.ident.version.InvalidVersionSpecificationException) ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) InvalidRefException(org.commonjava.maven.atlas.ident.ref.InvalidRefException) SimpleArtifactRef(org.commonjava.maven.atlas.ident.ref.SimpleArtifactRef) JoinString(org.commonjava.maven.atlas.ident.util.JoinString) URI(java.net.URI) ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) SimpleArtifactRef(org.commonjava.maven.atlas.ident.ref.SimpleArtifactRef)

Aggregations

URI (java.net.URI)1 SimplePluginDependencyRelationship (org.commonjava.maven.atlas.graph.rel.SimplePluginDependencyRelationship)1 ArtifactRef (org.commonjava.maven.atlas.ident.ref.ArtifactRef)1 InvalidRefException (org.commonjava.maven.atlas.ident.ref.InvalidRefException)1 ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)1 SimpleArtifactRef (org.commonjava.maven.atlas.ident.ref.SimpleArtifactRef)1 JoinString (org.commonjava.maven.atlas.ident.util.JoinString)1 InvalidVersionSpecificationException (org.commonjava.maven.atlas.ident.version.InvalidVersionSpecificationException)1 GalleyMavenException (org.commonjava.maven.galley.maven.GalleyMavenException)1 PluginDependencyView (org.commonjava.maven.galley.maven.model.view.PluginDependencyView)1