Java 类org.apache.maven.project.artifact.InvalidDependencyVersionException 实例源码

项目:clirr-maven-plugin    文件:AbstractClirrMojo.java   
protected List getTransitiveDependencies( final Set previousArtifacts )
    throws ProjectBuildingException, InvalidDependencyVersionException, ArtifactResolutionException,
    ArtifactNotFoundException
{
    final List dependencies = new ArrayList();
    for ( Iterator iter = previousArtifacts.iterator(); iter.hasNext(); )
    {
        final Artifact a = (Artifact) iter.next();
        final Artifact pomArtifact =
            factory.createArtifact( a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getScope(), "pom" );
        final MavenProject pomProject =
            mavenProjectBuilder.buildFromRepository( pomArtifact, project.getRemoteArtifactRepositories(),
                                                     localRepository );
        final Set pomProjectArtifacts = pomProject.createArtifacts( factory, null, null );
        final ArtifactResolutionResult result =
            resolver.resolveTransitively( pomProjectArtifacts, pomArtifact, localRepository,
                                          project.getRemoteArtifactRepositories(), metadataSource, null );
        dependencies.addAll( result.getArtifacts() );
    }
    return dependencies;
}
项目:maven-jaxb2-plugin    文件:RawXJC2Mojo.java   
protected void resolveEpisodeArtifacts()
        throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException {
    this.episodeArtifacts = new LinkedHashSet<Artifact>();
    {
        final Collection<Artifact> episodeArtifacts = ArtifactUtils.resolve(getArtifactFactory(),
                getArtifactResolver(), getLocalRepository(), getArtifactMetadataSource(), getEpisodes(),
                getProject());
        this.episodeArtifacts.addAll(episodeArtifacts);
    }
    {
        if (getUseDependenciesAsEpisodes()) {
            @SuppressWarnings("unchecked")
            final Collection<Artifact> projectArtifacts = getProject().getArtifacts();
            final AndArtifactFilter filter = new AndArtifactFilter();
            filter.add(new ScopeArtifactFilter(DefaultArtifact.SCOPE_COMPILE));
            filter.add(new TypeArtifactFilter("jar"));
            for (Artifact artifact : projectArtifacts) {
                if (filter.include(artifact)) {
                    this.episodeArtifacts.add(artifact);
                }
            }
        }
    }
    this.episodeFiles = ArtifactUtils.getFiles(this.episodeArtifacts);
}
项目:maven-jaxb2-plugin    文件:ArtifactUtils.java   
public static Collection<Artifact> resolve(
        final ArtifactFactory artifactFactory,
        final ArtifactResolver artifactResolver,
        final ArtifactRepository localRepository,
        final ArtifactMetadataSource artifactMetadataSource,
        final Dependency[] dependencies, final MavenProject project)
        throws InvalidDependencyVersionException,
        ArtifactResolutionException, ArtifactNotFoundException {
    if (dependencies == null) {
        return Collections.emptyList();
    }

    @SuppressWarnings("unchecked")
    final Set<Artifact> artifacts = MavenMetadataSource.createArtifacts(
            artifactFactory, Arrays.asList(dependencies), "runtime", null,
            project);

    for (Artifact artifact : artifacts) {
        artifactResolver.resolve(artifact,

        project.getRemoteArtifactRepositories(), localRepository);
    }

    final Set<Artifact> resolvedArtifacts = artifacts;
    return resolvedArtifacts;
}
项目:pkg-maven-plugin    文件:Utils.java   
/**
 * Gathers the project's artifacts and the artifacts of all its (transitive)
 * dependencies filtered by the given filter instance.
 * 
 * @param filter
 * @return
 * @throws ArtifactResolutionException
 * @throws ArtifactNotFoundException
 * @throws ProjectBuildingException
 * @throws InvalidDependencyVersionException
 */
@SuppressWarnings("unchecked")
public static Set<Artifact> findArtifacts(ArtifactFilter filter,
        ArtifactFactory factory, ArtifactResolver resolver,
        MavenProject project, Artifact artifact, ArtifactRepository local,
        List<ArtifactRepository> remoteRepos,
        ArtifactMetadataSource metadataSource)
        throws ArtifactResolutionException, ArtifactNotFoundException,
        ProjectBuildingException, InvalidDependencyVersionException {

    ArtifactResolutionResult result = resolver.resolveTransitively(
            project.getDependencyArtifacts(), artifact, local, remoteRepos,
            metadataSource, filter);

    return (Set<Artifact>) result.getArtifacts();
}
项目:maven-jaxb2-plugin    文件:RawXJC2Mojo.java   
protected void resolveArtifacts() throws MojoExecutionException {
    try {

        resolveXJCPluginArtifacts();
        resolveEpisodeArtifacts();
    } catch (ArtifactResolutionException arex) {
        throw new MojoExecutionException("Could not resolve the artifact.", arex);
    } catch (ArtifactNotFoundException anfex) {
        throw new MojoExecutionException("Artifact not found.", anfex);
    } catch (InvalidDependencyVersionException idvex) {
        throw new MojoExecutionException("Invalid dependency version.", idvex);
    }
}
项目:maven-jaxb2-plugin    文件:RawXJC2Mojo.java   
protected void resolveXJCPluginArtifacts()
        throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException {

    this.xjcPluginArtifacts = ArtifactUtils.resolveTransitively(getArtifactFactory(), getArtifactResolver(),
            getLocalRepository(), getArtifactMetadataSource(), getPlugins(), getProject());
    this.xjcPluginFiles = ArtifactUtils.getFiles(this.xjcPluginArtifacts);
    this.xjcPluginURLs = CollectionUtils.apply(this.xjcPluginFiles, IOUtils.GET_URL);
}
项目:maven-jaxb2-plugin    文件:ArtifactUtils.java   
public static Collection<Artifact> resolveTransitively(
        final ArtifactFactory artifactFactory,
        final ArtifactResolver artifactResolver,
        final ArtifactRepository localRepository,
        final ArtifactMetadataSource artifactMetadataSource,
        final Dependency[] dependencies, final MavenProject project)
        throws InvalidDependencyVersionException,
        ArtifactResolutionException, ArtifactNotFoundException {
    if (dependencies == null) {
        return Collections.emptyList();
    }

    @SuppressWarnings("unchecked")
    final Set<Artifact> artifacts = MavenMetadataSource.createArtifacts(
            artifactFactory, Arrays.asList(dependencies), "runtime", null,
            project);

    final ArtifactResolutionResult artifactResolutionResult = artifactResolver
            .resolveTransitively(artifacts,

            project.getArtifact(),

            project.getRemoteArtifactRepositories(), localRepository,
                    artifactMetadataSource);

    @SuppressWarnings("unchecked")
    final Set<Artifact> resolvedArtifacts = artifactResolutionResult
            .getArtifacts();

    return resolvedArtifacts;
}
项目:Pogamut3    文件:DependencyProjectStub.java   
public Set createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter )
    throws InvalidDependencyVersionException
{
    return Collections.EMPTY_SET;
}
项目:oceano    文件:MavenProject.java   
@Deprecated
public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter filter )
    throws InvalidDependencyVersionException
{
    return MavenMetadataSource.createArtifacts( artifactFactory, getDependencies(), inheritedScope, filter, this );
}
项目:oceano    文件:InvalidPluginException.java   
public InvalidPluginException( String message, InvalidDependencyVersionException e )
{
    super( message, e );
}
项目:oceano    文件:DefaultPluginManager.java   
public void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
    throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
    InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException
{
    throw new UnsupportedOperationException();
}
项目:oceano    文件:PluginManager.java   
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException;
项目:m2e-plugins    文件:ProcessRemoteResourcesMojo.java   
@SuppressWarnings( "unchecked" )
private Set<Artifact> aggregateProjectDependencyArtifacts()
    throws MojoExecutionException
{
    Set<Artifact> artifacts = new LinkedHashSet<Artifact>();

    List<MavenProject> projects = mavenSession.getSortedProjects();
    for ( MavenProject p : projects )
    {
        if ( p.getDependencyArtifacts() == null )
        {
            try
            {
                Set<Artifact> depArtifacts = p.createArtifacts( artifactFactory, null, null );

                if ( depArtifacts != null && !depArtifacts.isEmpty() )
                {
                    for ( Artifact artifact : depArtifacts )
                    {
                        if ( artifact.getVersion() == null && artifact.getVersionRange() != null )
                        {
                            // Version is required for equality comparison between artifacts,
                            // but it is not needed for our purposes of filtering out
                            // transitive dependencies (which requires only groupId/artifactId).
                            // Therefore set an arbitrary version if missing.
                            artifact.setResolvedVersion( Artifact.LATEST_VERSION );
                        }
                        artifacts.add( artifact );
                    }  
                }
            }
            catch ( InvalidDependencyVersionException e )
            {
                throw new MojoExecutionException(
                    "Failed to create dependency artifacts for: " + p.getId() + ". Reason: " + e.getMessage(), e );
            }
        }
    }

    return artifacts;
}
项目:jwrapper-maven-plugin    文件:MavenProjectDelegate.java   
@Override
public Set createArtifacts(final ArtifactFactory factory, final String s,
        final ArtifactFilter filter)
        throws InvalidDependencyVersionException {
    return getDelegate().createArtifacts(factory, s, filter);
}
项目:pkg-maven-plugin    文件:Helper.java   
public Set<Artifact> resolveProjectDependencies()
        throws MojoExecutionException {
    Set<Artifact> resolvedDeps = new HashSet<Artifact>();
    try {
        // Notice only compilation dependencies which are Jars.
        // Shared Libraries ("so") are filtered out because the
        // JNI dependency is solved by the system already.

        // Here a filter for depencies of the COMPILE scope is created
        AndArtifactFilter compileFilter = new AndArtifactFilter();
        compileFilter.add(new ScopeArtifactFilter(Artifact.SCOPE_COMPILE));
        compileFilter.add(new TypeArtifactFilter("jar"));

        // The result of the COMPILE filter will be added to the depencies
        // set
        resolvedDeps.addAll(Utils.findArtifacts(compileFilter, apm
                .getFactory(), apm.getResolver(), apm.getProject(), apm
                .getProject().getArtifact(), apm.getLocalRepo(), apm
                .getRemoteRepos(), apm.getMetadataSource()));

        // Here a filter for depencies of the RUNTIME scope is created
        AndArtifactFilter runtimeFilter = new AndArtifactFilter();
        runtimeFilter.add(new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME));
        runtimeFilter.add(new TypeArtifactFilter("jar"));

        // The result of the RUNTIME filter will be added to the depencies
        // set
        resolvedDeps.addAll(Utils.findArtifacts(runtimeFilter, apm
                .getFactory(), apm.getResolver(), apm.getProject(), apm
                .getProject().getArtifact(), apm.getLocalRepo(), apm
                .getRemoteRepos(), apm.getMetadataSource()));

        // Here a filter for depencies of the PROVIDED scope is created
        AndArtifactFilter providedFilter = new AndArtifactFilter();
        providedFilter
                .add(new ScopeArtifactFilter(Artifact.SCOPE_PROVIDED));
        providedFilter.add(new TypeArtifactFilter("jar"));

        // The result of the PROVIDED filter will be added to the depencies
        // set
        resolvedDeps.addAll(Utils.findArtifacts(providedFilter, apm
                .getFactory(), apm.getResolver(), apm.getProject(), apm
                .getProject().getArtifact(), apm.getLocalRepo(), apm
                .getRemoteRepos(), apm.getMetadataSource()));
    } catch (ArtifactNotFoundException anfe) {
        throw new MojoExecutionException(
                "Exception while resolving dependencies", anfe);
    } catch (InvalidDependencyVersionException idve) {
        throw new MojoExecutionException(
                "Exception while resolving dependencies", idve);
    } catch (ProjectBuildingException pbe) {
        throw new MojoExecutionException(
                "Exception while resolving dependencies", pbe);
    } catch (ArtifactResolutionException are) {
        throw new MojoExecutionException(
                "Exception while resolving dependencies", are);
    }

    return resolvedDeps;
}