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


Java Versioning.setLatest方法代码示例

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


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

示例1: a

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
private Metadata a(final String groupId,
                   final String artifactId,
                   final String lastUpdated,
                   final String latest,
                   final String release,
                   final String... versions)
{
  final Metadata m = new Metadata();
  m.setGroupId(groupId);
  m.setArtifactId(artifactId);
  m.setVersioning(new Versioning());
  final Versioning mv = m.getVersioning();
  if (!Strings.isNullOrEmpty(lastUpdated)) {
    mv.setLastUpdated(lastUpdated);
  }
  if (!Strings.isNullOrEmpty(latest)) {
    mv.setLatest(latest);
  }
  if (!Strings.isNullOrEmpty(release)) {
    mv.setRelease(release);
  }
  mv.getVersions().addAll(Arrays.asList(versions));
  return m;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:25,代码来源:RepositoryMetadataMergerTest.java

示例2: buildReleasesMavenMetadata

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
public static Metadata buildReleasesMavenMetadata(String organization, String module,
        SortedSet<String> sortedVersions) {
    Metadata metadata = new Metadata();
    metadata.setGroupId(organization);
    metadata.setArtifactId(module);
    if (!sortedVersions.isEmpty()) {
        metadata.setVersion(sortedVersions.first());
        Versioning versioning = new Versioning();
        metadata.setVersioning(versioning);
        versioning.setVersions(Lists.newArrayList(sortedVersions));
        versioning.setLastUpdatedTimestamp(new Date());
        versioning.setLatest(sortedVersions.last());
        versioning.setRelease(sortedVersions.last());
    }
    return metadata;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:17,代码来源:MavenModelUtils.java

示例3: 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

示例4: merge

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
@Override
protected void merge( Metadata recessive )
{
    Versioning versioning = metadata.getVersioning();
    versioning.updateTimestamp();

    if ( recessive.getVersioning() != null )
    {
        if ( versioning.getLatest() == null )
        {
            versioning.setLatest( recessive.getVersioning().getLatest() );
        }
        if ( versioning.getRelease() == null )
        {
            versioning.setRelease( recessive.getVersioning().getRelease() );
        }

        Collection<String> versions = new LinkedHashSet<String>( recessive.getVersioning().getVersions() );
        versions.addAll( versioning.getVersions() );
        versioning.setVersions( new ArrayList<String>( versions ) );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:VersionsMetadata.java

示例5: executeMojo

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
@Override
protected void executeMojo() throws MojoExecutionException {
  Artifact projectArtifact = project.getArtifact();

  Versioning versioning = new Versioning();
  versioning.setLatest(projectArtifact.getVersion());
  versioning.updateTimestamp();
  ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(projectArtifact, versioning);
  projectArtifact.addMetadata(metadata);

  GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata(project.getGroupId());
  groupMetadata.addPluginMapping(getGoalPrefix(), project.getArtifactId(), project.getName());

  projectArtifact.addMetadata(groupMetadata);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:16,代码来源:AddPluginArtifactMetadataMojo.java

示例6: 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

示例7: merge

import org.apache.maven.artifact.repository.metadata.Versioning; //导入方法依赖的package包/类
public void merge(Metadata otherMetadata, RepoResource foundResource) {
    long otherLastModified = foundResource.getLastModified();
    if (metadata == null) {
        metadata = otherMetadata;
        lastModified = otherLastModified;
        if (!mergeSnapshotVersions) {
            Versioning versioning = metadata.getVersioning();
            if (versioning != null) {
                versioning.setSnapshotVersions(null);
            }
        }
    } else {
        metadata.merge(otherMetadata);
        lastModified = Math.max(otherLastModified, lastModified);

        Versioning existingVersioning = metadata.getVersioning();
        if (existingVersioning != null) {
            List<String> versions = existingVersioning.getVersions();
            if (!CollectionUtils.isNullOrEmpty(versions)) {
                try {
                    Collections.sort(versions, new MavenVersionComparator());
                } catch (IllegalArgumentException e) {
                    // New Java 7 TimSort is pointing out the non transitive behavior
                    // of the Mercury version comparator => Doing fallback to natural string order
                    log.info(
                            "Hitting Mercury version comparator non transitive behavior message='" + e.getMessage() + "'");
                    if (log.isDebugEnabled()) {
                        log.debug("The lists of versions is: " + versions);
                    }
                    Collections.sort(versions);
                }
                // latest is simply the last (be it snapshot or release version)
                String latestVersion = versions.get(versions.size() - 1);
                existingVersioning.setLatest(latestVersion);

                // release is the latest non snapshot version
                for (String version : versions) {
                    if (!MavenNaming.isSnapshot(version)) {
                        existingVersioning.setRelease(version);
                    }
                }
            }
            SnapshotComparator comparator = MavenMetadataCalculator.createSnapshotComparator();
            // if there's a unique snapshot version prefer the one with the bigger build number
            Snapshot snapshot = existingVersioning.getSnapshot();
            Versioning otherMetadataVersioning = otherMetadata.getVersioning();
            if (otherMetadataVersioning != null) {
                Snapshot otherSnapshot = otherMetadataVersioning.getSnapshot();
                if (snapshot != null && otherSnapshot != null) {
                    if (comparator.compare(otherSnapshot, snapshot) > 0) {
                        snapshot.setBuildNumber(otherSnapshot.getBuildNumber());
                        snapshot.setTimestamp(otherSnapshot.getTimestamp());
                    }
                }
                if (mergeSnapshotVersions) {
                    addSnapshotVersions(existingVersioning, otherMetadataVersioning);
                }
            }
        }
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:62,代码来源:MergeableMavenMetadata.java


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