Package org.apache.maven.artifact.repository.metadata

Examples of org.apache.maven.artifact.repository.metadata.Metadata


        getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
        repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );

        int buildNumber = 0;
        Metadata repoMetadata = metadata.getMetadata();
        if ( ( repoMetadata != null )
            && ( repoMetadata.getVersioning() != null && repoMetadata.getVersioning().getSnapshot() != null ) )
        {
            buildNumber = repoMetadata.getVersioning().getSnapshot().getBuildNumber();
        }
        return buildNumber;
    }
View Full Code Here


        {
            try
            {
                Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE );

                Metadata pluginGroupMetadata = metadataReader.read( metadata.getFile(), options );

                List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();

                if ( plugins != null )
                {
                    for ( org.apache.maven.artifact.repository.metadata.Plugin plugin : plugins )
                    {
View Full Code Here

        repositoryMetadataManager.resolve( metadata, request );

        artifact.addMetadata( metadata );

        Metadata repoMetadata = metadata.getMetadata();
        String version = null;
        if ( repoMetadata != null && repoMetadata.getVersioning() != null )
        {
            version = constructVersion( repoMetadata.getVersioning(), artifact.getBaseVersion() );
        }

        if ( version == null )
        {
            // use the local copy, or if it doesn't exist - go to the remote repo for it
View Full Code Here

                {
                    if ( m instanceof SnapshotArtifactRepositoryMetadata )
                    {
                        SnapshotArtifactRepositoryMetadata snapshotMetadata = (SnapshotArtifactRepositoryMetadata) m;

                        Metadata metadata = snapshotMetadata.getMetadata();
                        Versioning versioning = metadata.getVersioning();
                        if ( versioning == null || versioning.getSnapshot() == null
                            || versioning.getSnapshot().isLocalCopy()
                            || versioning.getSnapshot().getTimestamp() == null )
                        {
                            continue;
View Full Code Here

     * @return Metadata
     */
    private Metadata parseMetadata( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        Metadata metadata = new Metadata();
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        metadata.setModelEncoding( parser.getInputEncoding() );
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( strict && ! foundRoot )
                {
                    throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null );
                }
                else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
                {
                    metadata.setGroupId( getTrimmedValue( parser.nextText() ) );
                }
                else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
                {
                    metadata.setArtifactId( getTrimmedValue( parser.nextText() ) );
                }
                else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
                {
                    metadata.setVersion( getTrimmedValue( parser.nextText() ) );
                }
                else if ( checkFieldWithDuplicate( parser, "versioning", null, parsed ) )
                {
                    metadata.setVersioning( parseVersioning( "versioning", parser, strict ) );
                }
                else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
                {
                    java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
                    metadata.setPlugins( plugins );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "plugin" ) )
                        {
                            plugins.add( parsePlugin( "plugin", parser, strict ) );
View Full Code Here

        assertTrue( versionDir.exists() );

        Reader r = new FileReader( new File( basedir, RepositoryCopier.MAVEN_METADATA) );

        Metadata metadata = reader.read( r );

        // Make sure our new versions has been setup as the release.
        assertEquals( version, metadata.getVersioning().getRelease() );

        assertEquals( "20070327020553", metadata.getVersioning().getLastUpdated() );

        // Make sure we didn't whack old versions.
        List versions = metadata.getVersioning().getVersions();

        assertTrue( versions.contains( "2.0.1" ) );

        assertTrue( versions.contains( "2.0.2" ) );
View Full Code Here

    {
        // Existing Metadata in target stage

        Reader existingMetadataReader = new FileReader( existingMetadata );

        Metadata existing = reader.read( existingMetadataReader );

        // Staged Metadata

        File stagedMetadataFile = new File( existingMetadata.getParentFile(), MAVEN_METADATA );

        Reader stagedMetadataReader = new FileReader( stagedMetadataFile );

        Metadata staged = reader.read( stagedMetadataReader );

        // Merge

        existing.merge( staged );
View Full Code Here

                ArtifactMetadata m = (ArtifactMetadata) i.next();
                if ( m instanceof SnapshotArtifactRepositoryMetadata )
                {
                    SnapshotArtifactRepositoryMetadata snapshotMetadata = (SnapshotArtifactRepositoryMetadata) m;

                    Metadata metadata = snapshotMetadata.getMetadata();
                    if ( metadata != null )
                    {
                        Versioning versioning = metadata.getVersioning();
                        if ( versioning != null )
                        {
                            Snapshot snapshot = versioning.getSnapshot();
                            if ( snapshot != null )
                            {
View Full Code Here

        this.artifact = artifact;
    }

    private static Metadata createRepositoryMetadata( Artifact artifact )
    {
        Metadata metadata = new Metadata();
        metadata.setGroupId( artifact.getGroupId() );
        metadata.setArtifactId( artifact.getArtifactId() );

        Versioning versioning = new Versioning();
        versioning.addVersion( artifact.getBaseVersion() );
        if ( !artifact.isSnapshot() )
        {
            versioning.setRelease( artifact.getBaseVersion() );
        }
        if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
        {
            versioning.setLatest( artifact.getBaseVersion() );
        }

        metadata.setVersioning( versioning );

        return metadata;
    }
View Full Code Here

        this.legacyFormat = legacyFormat;
    }

    protected static Metadata createRepositoryMetadata( Artifact artifact, boolean legacyFormat )
    {
        Metadata metadata = new Metadata();
        if ( !legacyFormat )
        {
            metadata.setModelVersion( "1.1.0" );
        }
        metadata.setGroupId( artifact.getGroupId() );
        metadata.setArtifactId( artifact.getArtifactId() );
        metadata.setVersion( artifact.getBaseVersion() );

        return metadata;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.repository.metadata.Metadata

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.