Examples of ArtifactResult


Examples of com.redhat.ceylon.cmr.api.ArtifactResult

    protected File getArtifact(RepositoryManager repoman, String modName, String modVersion, boolean optional) {
        ArtifactContext ac = new ArtifactContext(modName, modVersion, ArtifactContext.JS, ArtifactContext.JS_MODEL, ArtifactContext.RESOURCES);
        ac.setIgnoreDependencies(true);
        ac.setThrowErrorIfMissing(false);
        List<ArtifactResult> results = repoman.getArtifactResults(ac);
        ArtifactResult code = getArtifactType(results, ArtifactContext.JS);
        ArtifactResult model = getArtifactType(results, ArtifactContext.JS_MODEL);
        if (code == null || model == null) {
            if (optional) {
                return null;
            }
            throw new CeylonRunJsException("Cannot find module " + ModuleUtil.makeModuleName(modName, modVersion) + " in specified module repositories");
        }
        return model.artifact();
    }
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

      DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
      Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());
      ArtifactRequest request = new ArtifactRequest(queryArtifact, remoteRepos, null);
      try
      {
         ArtifactResult resolvedArtifact = system.resolveArtifact(session, request);
         Artifact artifact = resolvedArtifact.getArtifact();

         @SuppressWarnings("unchecked")
         FileResource<?> artifactResource = factory.create(FileResource.class, artifact.getFile());

         return DependencyBuilder.create()
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

    @Requirement
    private RepositorySystem repoSystem;

    @Override
    public File resolve(final MavenProject project, final String artifact) {
        final ArtifactResult result;
        try {
            ProjectBuildingRequest projectBuildingRequest = invoke(project, "getProjectBuildingRequest", ProjectBuildingRequest.class);

            final ArtifactRequest request = new ArtifactRequest();
            final DefaultArtifact defaultArtifact = createArtifact(artifact);
            request.setArtifact(defaultArtifact);
            @SuppressWarnings("unchecked")
            final List<RemoteRepository> repos = invoke(project, "getRemoteProjectRepositories", List.class);
            request.setRepositories(repos);
            result = repoSystem.resolveArtifact(invoke(projectBuildingRequest, "getRepositorySession", RepositorySystemSession.class), request);
        } catch (ArtifactResolutionException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        return result.getArtifact().getFile();
    }
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

        artifactRequest.setArtifact( artifact );
        for (RemoteRepository repo : remoteRepositoriesForRequest) {
            artifactRequest.addRepository(repo);
        }
        try {
            ArtifactResult artifactResult = aether.getSystem().resolveArtifact(aether.getSession(), artifactRequest);
            return artifactResult.getArtifact();
        } catch (ArtifactResolutionException e) {
            if (logUnresolvedArtifact) {
                log.warn("Unable to resolve artifact: " + artifactName, e);
            }
            return null;
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

      DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
      Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());
      ArtifactRequest request = new ArtifactRequest(queryArtifact, remoteRepos, null);
      try
      {
         ArtifactResult resolvedArtifact = system.resolveArtifact(session, request);
         Artifact artifact = resolvedArtifact.getArtifact();

         @SuppressWarnings("unchecked")
         FileResource<?> artifactResource = factory.create(FileResource.class, artifact.getFile());

         return DependencyBuilder.create()
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

        request.setArtifact((Artifact) artifact);
        request.setRepositories(projectRepositories);

        log.debug("Resolving artifact " + artifact + " from " + projectRepositories);

        ArtifactResult result;
        try {
            result = repositorySystem.resolveArtifact(repositorySystemSession, request);
        } catch (ArtifactResolutionException e) {
            log.warn("Cound not resolve " + artifact, e);
            return null;
        }

        log.debug("Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from " + result.getRepository());

        return result.getArtifact().getFile();
    }
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

        request.setArtifact(new DefaultArtifact(id));
        request.setRepositories(projectRepositories);

        log.debug("Resolving artifact " + id + " from " + projectRepositories);

        ArtifactResult result;
        try {
            result = repositorySystem.resolveArtifact(repositorySystemSession, request);
        } catch (ArtifactResolutionException e) {
            log.warn("Could not resolve " + id, e);
            throw new MojoFailureException(format("Couldn't resolve artifact %s", id), e);
        }

        log.debug("Resolved artifact " + id + " to " + result.getArtifact().getFile() + " from " + result.getRepository());

        return result.getArtifact().getFile();
    }
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

        try
        {
            ArtifactRequest pomRequest = new ArtifactRequest();
            pomRequest.setArtifact( pomArtifact );
            pomRequest.setRepositories( config.repositories );
            ArtifactResult pomResult = repoSystem.resolveArtifact( config.session, pomRequest );

            pomArtifact = pomResult.getArtifact();
            localProject = pomResult.getRepository() instanceof WorkspaceRepository;
        }
        catch ( org.eclipse.aether.resolution.ArtifactResolutionException e )
        {
            if ( e.getResults().get( 0 ).isMissing() && allowStubModel )
            {
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

            return;
        }

        if ( !artifact.isResolved() )
        {
            ArtifactResult result;

            try
            {
                ArtifactRequest artifactRequest = new ArtifactRequest();
                artifactRequest.setArtifact( RepositoryUtils.toArtifact( artifact ) );
                artifactRequest.setRepositories( RepositoryUtils.toRepos( remoteRepositories ) );

                // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not
                LocalRepositoryManager lrm = session.getLocalRepositoryManager();
                String path = lrm.getPathForLocalArtifact( artifactRequest.getArtifact() );
                artifact.setFile( new File( lrm.getRepository().getBasedir(), path ) );

                result = repoSystem.resolveArtifact( session, artifactRequest );
            }
            catch ( org.eclipse.aether.resolution.ArtifactResolutionException e )
            {
                if ( e.getCause() instanceof org.eclipse.aether.transfer.ArtifactNotFoundException )
                {
                    throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e );
                }
                else
                {
                    throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
                }
            }

            artifact.selectVersion( result.getArtifact().getVersion() );
            artifact.setFile( result.getArtifact().getFile() );
            artifact.setResolved( true );

            if ( artifact.isSnapshot() )
            {
                Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
View Full Code Here

Examples of org.eclipse.aether.resolution.ArtifactResult

    {
        List<ArtifactResult> results = new ArrayList<ArtifactResult>();

        for ( ArtifactRequest request : requests )
        {
            ArtifactResult result = new ArtifactResult( request );
            results.add( result );

            Artifact artifact = request.getArtifact();
            if ( "maven-test".equals( artifact.getGroupId() ) )
            {
                String scope = artifact.getArtifactId().substring( "scope-".length() );

                try
                {
                    artifact =
                        artifact.setFile( ProjectClasspathTest.getFileForClasspathResource( ProjectClasspathTest.dir
                            + "transitive-" + scope + "-dep.xml" ) );
                    result.setArtifact( artifact );
                }
                catch ( FileNotFoundException e )
                {
                    throw new IllegalStateException( "Missing test POM for " + artifact );
                }
            }
            else
            {
                result.addException( new ArtifactNotFoundException( artifact, null ) );
                throw new ArtifactResolutionException( results );
            }
        }

        return results;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.