当前位置: 首页>>代码示例>>Java>>正文


Java Versioning.addVersion方法代码示例

本文整理汇总了Java中org.apache.maven.artifact.repository.metadata.Versioning.addVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Versioning.addVersion方法的具体用法?Java Versioning.addVersion怎么用?Java Versioning.addVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.artifact.repository.metadata.Versioning的用法示例。


在下文中一共展示了Versioning.addVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMetadata

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
private static Metadata createMetadata( Artifact artifact )
{
    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 metadata = new Metadata();
    metadata.setVersioning( versioning );
    metadata.setGroupId( artifact.getGroupId() );
    metadata.setArtifactId( artifact.getArtifactId() );

    return metadata;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:VersionsMetadata.java

示例2: createMetadata

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
private ArtifactMetadata createMetadata( Artifact artifact )
{
    Versioning versioning = new Versioning();
    versioning.updateTimestamp();
    versioning.addVersion( artifact.getVersion() );

    if ( artifact.isRelease() )
    {
        versioning.setRelease( artifact.getVersion() );
    }

    return new ArtifactRepositoryMetadata( artifact, versioning );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ReleaseArtifactTransformation.java

示例3: writeMetadata

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
private static void writeMetadata(Artifact a, File repository) {
    Versioning v = new Versioning();

    // while multiple POMs get downloaded for the same groupId+artifactId,
    // there'll be only one jar for each groupId+artifactId, so we just need
    // to record that
    v.setRelease(a.getVersion());
    v.setLatest(a.getVersion());
    v.addVersion(a.getVersion());

    ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(
            new DefaultArtifact(a.getGroupId(), a.getArtifactId(),
            VersionRange.createFromVersion(a.getVersion()),
            null, a.getExtension(), null,new DefaultArtifactHandler()),v );

    File metadataFile = new File(repository,
            a.getGroupId().replace('.', '/')+"/" +
            a.getArtifactId() +"/maven-metadata.xml");

    MetadataXpp3Writer metadataWriter = new MetadataXpp3Writer();

    Writer writer = null;
    try {
        writer = new FileWriter(metadataFile);

        metadataWriter.write(writer, metadata.getMetadata());
    } catch (IOException e) {
        throw new Error("Error writing artifact metdata.", e);
    } finally {
        IOUtil.close(writer);
    }

}
 
开发者ID:ndeloof,项目名称:bees-cli-bootstrap,代码行数:34,代码来源:Assembler.java

示例4: install

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
public void install( File source, Artifact artifact, ArtifactRepository localRepository )
    throws ArtifactInstallationException
{
    RepositorySystemSession session =
        LegacyLocalRepositoryManager.overlay( localRepository, legacySupport.getRepositorySession(), repoSystem );

    InstallRequest request = new InstallRequest();

    request.setTrace( DefaultRequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) );

    org.sonatype.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact );
    mainArtifact = mainArtifact.setFile( source );
    request.addArtifact( mainArtifact );

    for ( ArtifactMetadata metadata : artifact.getMetadataList() )
    {
        if ( metadata instanceof ProjectArtifactMetadata )
        {
            org.sonatype.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
            pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
            request.addArtifact( pomArtifact );
        }
        else if ( metadata instanceof SnapshotArtifactRepositoryMetadata
            || metadata instanceof ArtifactRepositoryMetadata )
        {
            // eaten, handled by repo system
        }
        else
        {
            request.addMetadata( new MetadataBridge( metadata ) );
        }
    }

    try
    {
        repoSystem.install( session, request );
    }
    catch ( InstallationException e )
    {
        throw new ArtifactInstallationException( e.getMessage(), e );
    }

    /*
     * NOTE: Not used by Maven core, only here to provide backward-compat with plugins like the Install Plugin.
     */

    if ( artifact.isSnapshot() )
    {
        Snapshot snapshot = new Snapshot();
        snapshot.setLocalCopy( true );
        artifact.addMetadata( new SnapshotArtifactRepositoryMetadata( artifact, snapshot ) );
    }

    Versioning versioning = new Versioning();
    versioning.updateTimestamp();
    versioning.addVersion( artifact.getBaseVersion() );
    if ( artifact.isRelease() )
    {
        versioning.setRelease( artifact.getBaseVersion() );
    }
    artifact.addMetadata( new ArtifactRepositoryMetadata( artifact, versioning ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:63,代码来源:DefaultArtifactInstaller.java


注:本文中的org.apache.maven.artifact.repository.metadata.Versioning.addVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。