Examples of ArtifactRepository


Examples of com.caucho.loader.module.ArtifactRepository

  @PostConstruct
  public void init()
  {
    update();

    ArtifactRepository repository = ArtifactRepository.create();

    repository.addResolver(this);
  }
View Full Code Here

Examples of org.apache.ace.client.repository.repository.ArtifactRepository

     * @param obrBaseUrl the base URL of the OBR, cannot be <code>null</code>.
     * @return a list of used OBR entries, never <code>null</code>.
     * @throws IOException in case an artifact repository is not present.
     */
    private List<OBREntry> getUsedOBRArtifacts(URL obrBaseUrl) throws IOException {
        ArtifactRepository artifactRepository = getArtifactRepository();
        if (artifactRepository == null) {
            throw new IOException("No artifact repository present!");
        }

        final String baseURL = obrBaseUrl.toExternalForm();

        List<OBREntry> fromRepository = new ArrayList<OBREntry>();

        List<ArtifactObject> artifactObjects = artifactRepository.get();
        artifactObjects.addAll(artifactRepository.getResourceProcessors());

        for (ArtifactObject ao : artifactObjects) {
            String artifactURL = ao.getURL();
            if (artifactURL != null && artifactURL.startsWith(baseURL)) {
                // we now know this artifact comes from the OBR we are querying,
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

    private Artifact getArtifact(
        final Dependency dependency,
        final String scope)
    {
        Artifact artifact = null;
        final ArtifactRepository localRepository = this.localRepository;
        final MavenProject project = this.project;
        if (project != null && localRepository != null)
        {
            if (dependency != null)
            {
                artifact =
                    this.factory.createArtifact(
                        dependency.getGroupId(),
                        dependency.getArtifactId(),
                        dependency.getVersion(),
                        scope,
                        dependency.getType());
                final File file = new File(
                        localRepository.getBasedir(),
                        localRepository.pathOf(artifact));
                artifact.setFile(file);
            }
        }
        return artifact;
    }
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

     */
    private void addDependency(
        final Dependency dependency,
        final String scope)
    {
        final ArtifactRepository localRepository = this.getLocalRepository();
        final MavenProject project = this.getProject();
        if (project != null && localRepository != null)
        {
            if (dependency != null)
            {
                final Artifact artifact =
                    this.getFactory().createArtifact(
                        dependency.getGroupId(),
                        dependency.getArtifactId(),
                        dependency.getVersion(),
                        scope,
                        dependency.getType());
                final File file = new File(
                        localRepository.getBasedir(),
                        localRepository.pathOf(artifact));
                artifact.setFile(file);
                project.getDependencies().add(dependency);
                project.getArtifacts().add(artifact);
            }
        }
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

        if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
        {
            return;
        }

        ArtifactRepository localRepo = request.getLocalRepository();

        File localFile = new File( localRepo.getBasedir(), localRepo.pathOf( artifact ) );

        artifact.setFile( localFile );

        if ( !localFile.exists() )
        {
            if ( request.getRemoteRepositories().isEmpty() )
            {
                throw new IOException( localFile + " does not exist and no remote repositories are configured" );
            }

            ArtifactRepository remoteRepo = request.getRemoteRepositories().get( 0 );

            File remoteFile = new File( remoteRepo.getBasedir(), remoteRepo.pathOf( artifact ) );

            FileUtils.copyFile( remoteFile, localFile );
        }

        artifact.setResolved( true );
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

                return;
            }
        }

        ArtifactRepository localRepository = request.getLocalRepository();
        List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories();

        if ( !request.isOffline() )
        {
            Date localCopyLastModified = getLocalCopyLastModified( localRepository, metadata );

            for ( ArtifactRepository repository : remoteRepositories )
            {
                ArtifactRepositoryPolicy policy = metadata.getPolicy( repository );

                File file =
                    new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata,
                                                                                                           repository ) );
                boolean update;

                if ( !policy.isEnabled() )
                {
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

        // snapshot timestamp, or some other timestamp later encoded into the metadata.
        // TODO: this needs to be repeated here so the merging doesn't interfere with the written metadata
        //  - we'd be much better having a pristine input, and an ongoing metadata for merging instead

        Map<ArtifactRepository, Metadata> previousMetadata = new HashMap<ArtifactRepository, Metadata>();
        ArtifactRepository selected = null;
        for ( ArtifactRepository repository : remoteRepositories )
        {
            ArtifactRepositoryPolicy policy = metadata.getPolicy( repository );

            if ( policy.isEnabled() && loadMetadata( metadata, repository, localRepository, previousMetadata ) )
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

                    {
                        return false;
                    }
                    break;
                }
                ArtifactRepository repo1 = it1.next();
                ArtifactRepository repo2 = it2.next();
                if ( !repoEquals( repo1, repo2 ) )
                {
                    return false;
                }
            }
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

            artifact.setResolved( true );

            return;
        }

        ArtifactRepository localRepository = request.getLocalRepository();

        List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories();

        if ( !artifact.isResolved() )
        {
            // ----------------------------------------------------------------------
            // Check for the existence of the artifact in the specified local
            // ArtifactRepository. If it is present then simply return as the
            // request for resolution has been satisfied.
            // ----------------------------------------------------------------------

            artifact = localRepository.find( artifact );

            if ( artifact.isResolved() )
            {
                return;
            }

            transformationManager.transformForResolve( artifact, request );

            destination = artifact.getFile();

            if ( !request.isOffline() && ( force || !destination.exists() || isMutable( artifact ) ) )
            {
                try
                {
                    if ( artifact.getRepository() != null )
                    {
                        // the transformations discovered the artifact - so use it exclusively
                        wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor,
                                                  request.isForceUpdate() );
                    }
                    else
                    {
                        wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor,
                                                  request.isForceUpdate() );
                    }

                    if ( localRepositoryMaintainer != null )
                    {
                        LocalRepositoryMaintainerEvent event =
                            new DefaultLocalRepositoryMaintainerEvent( localRepository, artifact, null );
                        localRepositoryMaintainer.artifactDownloaded( event );
                    }

                }
                catch ( ResourceDoesNotExistException e )
                {
                    throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e );
                }
                catch ( TransferFailedException e )
                {
                    throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
                }
            }

            if ( destination.exists() )
            {
                artifact.setResolved( true );
            }
            else
            {
                if ( request.isOffline() )
                {
                    throw new ArtifactResolutionException( "The repository system is offline"
                        + " and the requested artifact is not locally available at " + destination, artifact,
                                                           remoteRepositories );
                }
                else
                {
                    throw new ArtifactResolutionException( "Failed to resolve artifact, possibly due to a "
                        + "repository list that is not appropriately equipped for this artifact's metadata.", artifact,
                                                           remoteRepositories );
                }
            }

            // 1.0-SNAPSHOT
            //
            // 1)         pom = 1.0-SNAPSHOT
            // 2)         pom = 1.0-yyyymmdd.hhmmss
            // 3) baseVersion = 1.0-SNAPSHOT
            if ( artifact.isSnapshot() && isTimestamped( artifact ) )
            {
                String version = artifact.getVersion();

                // 1.0-SNAPSHOT
                artifact.selectVersion( artifact.getBaseVersion() );

                // Make a file with a 1.0-SNAPSHOT format
                File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );

                // if the timestamped version was resolved or the copy doesn't exist then copy a version
                // of the file like 1.0-SNAPSHOT. Even if there is a timestamped version the non-timestamped
                // version will be created.
                if ( !copy.exists() || copy.lastModified() != destination.lastModified()
View Full Code Here

Examples of org.apache.maven.artifact.repository.ArtifactRepository

            {
                if ( repository instanceof Repository )
                {
                    try
                    {
                        ArtifactRepository repo = repositorySystem.buildArtifactRepository( (Repository) repository );
                        repositorySystem.injectMirror( Arrays.asList( repo ), configuration.getMirrors() );
                        repositorySystem.injectProxy( Arrays.asList( repo ), configuration.getProxies() );
                        repositorySystem.injectAuthentication( Arrays.asList( repo ), configuration.getServers() );
                        repos.add( repo );
                    }
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.