Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.ArtifactReference


            {
                // Nothing to do here, file doesn't exist, skip it.
                return;
            }

            ArtifactReference artifact = repository.toArtifactReference( path );

            if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
            {
                // Nothing to do here, not a snapshot, skip it.
                return;
            }

            ProjectReference reference = new ProjectReference();
            reference.setGroupId( artifact.getGroupId() );
            reference.setArtifactId( artifact.getArtifactId() );

            // Gather up all of the versions.
            List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) );

            // Split the versions into released and snapshots.
            List<String> releasedVersions = new ArrayList<String>();
            List<String> snapshotVersions = new ArrayList<String>();

            for ( String version : allVersions )
            {
                if ( VersionUtil.isSnapshot( version ) )
                {
                    snapshotVersions.add( version );
                }
                else
                {
                    releasedVersions.add( version );
                }
            }

            Collections.sort( allVersions, VersionComparator.getInstance() );
            Collections.sort( releasedVersions, VersionComparator.getInstance() );
            Collections.sort( snapshotVersions, VersionComparator.getInstance() );

            VersionedReference versionRef = new VersionedReference();
            versionRef.setGroupId( artifact.getGroupId() );
            versionRef.setArtifactId( artifact.getArtifactId() );

            for ( String version : snapshotVersions )
            {
                if ( releasedVersions.contains( VersionUtil.getReleaseVersion( version ) ) )
                {
View Full Code Here


        {
            Configuration config = configuration.getConfiguration();
            ManagedRepositoryConfiguration repoConfig =
                config.findManagedRepositoryById( repositoryId );

            ArtifactReference artifactReference = new ArtifactReference();
            artifactReference.setArtifactId( artifactId );
            artifactReference.setGroupId( groupId );
            artifactReference.setVersion( version );
            artifactReference.setClassifier( classifier );
            artifactReference.setType( packaging );

            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );

            String artifactPath = repository.toPath( artifactReference );
View Full Code Here

                // check if target repo is enabled for releases
                // we suppose that release-artifacts can be deployed only to repos enabled for releases
                if ( managedRepository.getRepository().isReleases() && !repositoryRequest.isMetadata( resourcePath ) &&
                    !repositoryRequest.isSupportFile( resourcePath ) )
                {
                    ArtifactReference artifact = null;
                    try
                    {
                        artifact = managedRepository.toArtifactReference( resourcePath );
                       
                        if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
                        {
                            // check if artifact already exists and if artifact re-deployment to the repository is allowed
                            if ( managedRepository.hasContent( artifact ) && managedRepository.getRepository().isBlockRedeployments() )
                            {
                                log.warn( "Overwriting released artifacts in repository '" + managedRepository.getId() + "' is not allowed." );
View Full Code Here

        // Not any of the above? Then it's gotta be an artifact reference.
        try
        {
            // Get the artifact reference in a layout neutral way.
            ArtifactReference artifact = repositoryRequest.toArtifactReference( path );

            if ( artifact != null )
            {
                applyServerSideRelocation( managedRepository, artifact );

                File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact );

                resource.setPath( managedRepository.toPath( artifact ) );

                log.debug( "Proxied artifact '" + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" +
                    artifact.getVersion() + "'" );

                return ( proxiedFile != null );
            }
        }
        catch ( LayoutException e )
View Full Code Here

        {
            return;
        }

        // Build the artifact POM reference
        ArtifactReference pomReference = new ArtifactReference();
        pomReference.setGroupId( artifact.getGroupId() );
        pomReference.setArtifactId( artifact.getArtifactId() );
        pomReference.setVersion( artifact.getVersion() );
        pomReference.setType( "pom" );

        // Get the artifact POM from proxied repositories if needed
        connectors.fetchFromProxies( managedRepository, pomReference );

        // Open and read the POM from the managed repo
View Full Code Here

    public void processFile( String path )
        throws ConsumerException
    {
        try
        {
            ArtifactReference reference = managedRepository.toArtifactReference( path );
            Artifact artifact = artifactFactory.createArtifact( reference.getGroupId(), reference.getArtifactId(),
                                                                reference.getVersion(), reference.getClassifier(),
                                                                reference.getType() );
            artifactConverter.convert( artifact, destinationRepository );
        }
        catch ( LayoutException e )
        {
            log.warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e );
View Full Code Here

        // Ignore paths like .indexer etc
        if ( !path.startsWith( "." ) )
        {
            try
            {
                ArtifactReference artifact = repository.toArtifactReference( path );
                updateVersionMetadata( artifact, path );
                updateProjectMetadata( artifact, path );
            }
            catch ( LayoutException e )
            {
View Full Code Here

        }
    }

    private ArtifactReference getArtifactReference( Element elemPlugin, String defaultType )
    {
        ArtifactReference reference = new ArtifactReference();

        reference.setGroupId( StringUtils.defaultString( elemPlugin.elementTextTrim( "groupId" ) ) );
        reference.setArtifactId( elemPlugin.elementTextTrim( "artifactId" ) );
        reference.setVersion( StringUtils.defaultString( elemPlugin.elementTextTrim( "version" ) ) );
        reference.setClassifier( StringUtils.defaultString( elemPlugin.elementTextTrim( "classifier" ) ) );
        reference.setType( StringUtils.defaultIfEmpty( elemPlugin.elementTextTrim( "type" ), defaultType ) );

        return reference;
    }
View Full Code Here

{
    private MemoryRepository memoryRepository;

    public ArchivaProjectModel resolveProjectModel( VersionedReference reference )
    {
        ArtifactReference artifact = new ArtifactReference();
        artifact.setGroupId( reference.getGroupId() );
        artifact.setArtifactId( reference.getArtifactId() );
        artifact.setVersion( reference.getVersion() );
        artifact.setType( "pom" );

        return resolveProjectModel( artifact );
    }
View Full Code Here

        new FlagCyclicEdgesTask().executeTask( graph );

        DependencyGraphWalker walker = new WalkDepthFirstSearch();
        WalkCollector walkCollector = new WalkCollector();
        ArtifactReference startRef = toArtifactReference( "org.foo:foo-xml:1.0::jar" );
        DependencyGraphNode startNode = new DependencyGraphNode( startRef );
        walker.visit( graph, startNode, walkCollector );

        String expectedPath[] = new String[] {
            "org.foo:foo-xml:1.0::jar",
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.ArtifactReference

Copyright © 2018 www.massapicom. 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.