本文整理了Java中org.apache.maven.artifact.repository.metadata.Versioning.getVersions()
方法的一些代码示例,展示了Versioning.getVersions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Versioning.getVersions()
方法的具体详情如下:
包路径:org.apache.maven.artifact.repository.metadata.Versioning
类名称:Versioning
方法名:getVersions
[英]Method getVersions.
[中]方法getVersions。
代码示例来源:origin: apache/maven
/**
* Method addVersion.
*
* @param string
*/
public void addVersion( String string )
{
getVersions().add( string );
} //-- void addVersion( String )
代码示例来源:origin: apache/maven
/**
* Method removeVersion.
*
* @param string
*/
public void removeVersion( String string )
{
getVersions().remove( string );
} //-- void removeVersion( String )
代码示例来源:origin: apache/maven
private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata( Metadata repoMetadata,
List<String> availableVersions )
{
Collection<String> versions = new LinkedHashSet<>();
if ( ( repoMetadata != null ) && ( repoMetadata.getVersioning() != null ) )
{
versions.addAll( repoMetadata.getVersioning().getVersions() );
}
versions.addAll( availableVersions );
List<ArtifactVersion> artifactVersions = new ArrayList<>( versions.size() );
for ( String version : versions )
{
artifactVersions.add( new DefaultArtifactVersion( version ) );
}
return artifactVersions;
}
代码示例来源:origin: apache/maven
private void mergeMetadata( Versions versions, Metadata source, ArtifactRepository repository )
{
Versioning versioning = source.getVersioning();
if ( versioning != null )
{
String timestamp = StringUtils.clean( versioning.getLastUpdated() );
if ( StringUtils.isNotEmpty( versioning.getRelease() )
&& timestamp.compareTo( versions.releaseTimestamp ) > 0 )
{
versions.releaseVersion = versioning.getRelease();
versions.releaseTimestamp = timestamp;
versions.releaseRepository = repository;
}
if ( StringUtils.isNotEmpty( versioning.getLatest() )
&& timestamp.compareTo( versions.latestTimestamp ) > 0 )
{
versions.latestVersion = versioning.getLatest();
versions.latestTimestamp = timestamp;
versions.latestRepository = repository;
}
for ( String version : versioning.getVersions() )
{
if ( !versions.versions.containsKey( version ) )
{
versions.versions.put( version, repository );
}
}
}
}
代码示例来源:origin: org.apache.maven/maven-project
if ( repoMetadata != null && repoMetadata.getVersioning() != null )
List metadataVersions = repoMetadata.getVersioning().getVersions();
versions = new ArrayList( metadataVersions.size() );
for ( Iterator i = metadataVersions.iterator(); i.hasNext(); )
代码示例来源:origin: apache/maven
@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<>( recessive.getVersioning().getVersions() );
versions.addAll( versioning.getVersions() );
versioning.setVersions( new ArrayList<>( versions ) );
}
}
代码示例来源:origin: apache/maven
if ( ( versioning.getVersions() != null ) && ( versioning.getVersions().size() > 0 ) )
for ( Iterator iter = versioning.getVersions().iterator(); iter.hasNext(); )
代码示例来源:origin: apache/maven
for ( String version : versioning.getVersions() )
代码示例来源:origin: apache/maven
for ( String version : versioning.getVersions() )
if ( !v.getVersions().contains( version ) )
v.getVersions().add( version );
代码示例来源:origin: io.tesla.maven/maven-repository-metadata
/**
* Method addVersion.
*
* @param string
*/
public void addVersion( String string )
{
getVersions().add( string );
} //-- void addVersion( String )
代码示例来源:origin: io.tesla.maven/maven-repository-metadata
/**
* Method removeVersion.
*
* @param string
*/
public void removeVersion( String string )
{
getVersions().remove( string );
} //-- void removeVersion( String )
代码示例来源:origin: org.seasar.kvasir/kvasir-system
@SuppressWarnings("unchecked")
private Version getNewestVersion(final Versioning versioning)
{
final List<String> versions = versioning.getVersions();
Version newest = null;
for (final String version : versions) {
final Version v = new Version(version);
if ((newest == null) || (newest.compareTo(v) < 0)) {
newest = v;
}
}
return newest;
}
代码示例来源:origin: com.cloudbees/bees-maven-components
/**
* List up all the versions found in the metadata.
*/
private void merge(Versioning versioning, ArtifactRepository from, List<VersionInfo> found) {
if ( StringUtils.isNotEmpty( versioning.getRelease() ) )
found.add(new VersionInfo(versioning.getRelease(),from));
if ( StringUtils.isNotEmpty( versioning.getLatest() ) )
found.add(new VersionInfo(versioning.getLatest(),from));
for ( String v : versioning.getVersions() )
found.add(new VersionInfo(v,from));
}
代码示例来源:origin: org.seasar.kvasir/kvasir-system
@SuppressWarnings("unchecked")
public List<Version> getAvailableVersions(final String pluginId,
final boolean excludeSnapshot)
{
final Metadata metadata = getMetadata(pluginId);
final Versioning versioning = metadata.getVersioning();
if (versioning == null) {
return new ArrayList<Version>();
}
final List<String> versions = versioning.getVersions();
final List<Version> v = new ArrayList<Version>();
for (final String versionStr : versions) {
final Version version = new Version(versionStr);
if (excludeSnapshot && version.isSnapshot()) {
continue;
}
v.add(version);
}
Collections.sort(v);
return v;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-repository-maven
private boolean versioningEquals(@Nullable final Versioning v1,
@Nullable final Versioning v2) { // NOSONAR
if (v1 == null || v2 == null) {
return v1 == v2; // NOSONAR
}
else {
return
Objects.equals(v1.getLatest(), v2.getLatest()) && // NOSONAR
Objects.equals(v1.getRelease(), v2.getRelease()) &&
snapshotEquals(v1.getSnapshot(), v2.getSnapshot()) &&
Objects.equals(v1.getVersions(), v2.getVersions()) &&
snapshotVersionsEquals(v1.getSnapshotVersions(), v2.getSnapshotVersions());
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-proxy
protected Metadata cleanseMetadataForRepository( boolean snapshot, Metadata metadata )
{
// remove base versions not belonging here
List<String> versions = metadata.getVersioning().getVersions();
for ( Iterator<String> iversion = versions.iterator(); iversion.hasNext(); )
{
// if we need snapshots and the version is not snapshot, or
// if we need releases and the version is snapshot
if ( ( snapshot && !Gav.isSnapshot( iversion.next() ) )
|| ( !snapshot && Gav.isSnapshot( iversion.next() ) ) )
{
iversion.remove();
}
}
metadata.getVersioning().setLatest( getLatestVersion( metadata.getVersioning().getVersions() ) );
if ( snapshot )
{
metadata.getVersioning().setRelease( null );
}
else
{
metadata.getVersioning().setRelease( metadata.getVersioning().getLatest() );
}
return metadata;
}
代码示例来源:origin: org.apache.maven/maven-aether-provider
@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<>( recessive.getVersioning().getVersions() );
versions.addAll( versioning.getVersions() );
versioning.setVersions( new ArrayList<>( versions ) );
}
}
代码示例来源:origin: io.tesla.maven/maven-aether-provider
@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 ) );
}
}
代码示例来源:origin: org.apache.maven/maven-resolver-provider
@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<>( recessive.getVersioning().getVersions() );
versions.addAll( versioning.getVersions() );
versioning.setVersions( new ArrayList<>( versions ) );
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-proxy
@Override
protected boolean isMetadataCorrect( Metadata oldMd, String path )
throws IOException
{
if ( oldMd.getArtifactId() == null || oldMd.getGroupId() == null || oldMd.getVersion() == null
|| oldMd.getVersioning() == null || oldMd.getVersioning().getSnapshot() == null
|| oldMd.getVersioning().getSnapshot().getTimestamp() == null )
{
return false;
}
Metadata md = createMetadata( path );
if ( StringUtils.equals( oldMd.getArtifactId(), md.getArtifactId() )
&& StringUtils.equals( oldMd.getGroupId(), md.getGroupId() )
&& StringUtils.equals( oldMd.getVersion(), md.getVersion() )
&& md.getVersioning() != null
&& md.getVersioning().getSnapshot() != null
&& StringUtils.equals( oldMd.getVersioning().getSnapshot().getTimestamp(),
md.getVersioning().getSnapshot().getTimestamp() )
&& oldMd.getVersioning().getSnapshot().getBuildNumber() == md.getVersioning().getSnapshot().getBuildNumber()
&& ( oldMd.getVersioning().getVersions().containsAll( md.getVersioning().getVersions() ) && md.getVersioning().getVersions().containsAll(
oldMd.getVersioning().getVersions() ) )
&& equals( oldMd.getVersioning().getSnapshotVersions(), md.getVersioning().getSnapshotVersions() ) )
{
return true;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!