congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
VersionUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
VersionUtil
in
org.apache.archiva.common.utils

Best Java code snippets using org.apache.archiva.common.utils.VersionUtil (Showing top 20 results out of 315)

origin: apache/archiva

private boolean isProjectVersion( Path dir )
{
  final String artifactId = dir.getParent().getFileName().toString();
  final String projectVersion = dir.getFileName().toString();
  // check if there is a POM artifact file to ensure it is a version directory
  Predicate<Path> filter;
  if ( VersionUtil.isSnapshot( projectVersion ) )
  {
    filter = new PomFilenameFilter(artifactId, projectVersion);
  }
  else
  {
    final String pomFile = artifactId + "-" + projectVersion + ".pom";
    filter = new PomFileFilter(pomFile);
  }
  try(Stream<Path> stream = Files.list(dir)) {
    if (stream.filter(Files::isRegularFile).anyMatch(filter)){
      return true;
    }
  } catch (IOException e) {
    LOGGER.error("Could not list directory {}: {}", dir, e.getMessage(), e);
  }
  // if a metadata file is present, check if this is the "version" directory, marking it as a project version
  ArchivaRepositoryMetadata metadata = readMetadata( dir );
  if ( metadata != null && projectVersion.equals( metadata.getVersion() ) )
  {
    return true;
  }
  return false;
}
origin: org.apache.archiva/archiva-model

public ArchivaArtifact( ArchivaArtifactModel artifactModel )
{
  this.model = artifactModel;
  model.setSnapshot( VersionUtil.isSnapshot( model.getVersion() ) );
  this.baseVersion = VersionUtil.getBaseVersion( model.getVersion() );
}

origin: org.apache.archiva/archiva-common

public static boolean isSnapshot( String version )
{
  Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
  if ( m.matches() )
  {
    return true;
  }
  else
  {
    return isGenericSnapshot( version );
  }
}
origin: apache/archiva

metadata.setArtifactId( reference.getArtifactId() );
if ( VersionUtil.isSnapshot( reference.getVersion() ) )
  metadata.setVersion( VersionUtil.getBaseVersion( reference.getVersion() ) );
  if ( VersionUtil.isUniqueSnapshot( latestVersion ) )
  else if ( VersionUtil.isGenericSnapshot( latestVersion ) )
origin: apache/archiva

VersionUtil.isSnapshot( artifact.getVersion() ) | VersionUtil.isGenericSnapshot( artifact.getVersion() );
  String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() );
  artifacts =
    metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
                          VersionUtil.getBaseVersion( artifact.getVersion() ) );
origin: org.apache.archiva/maven2-repository

  @Override
  public boolean accept( File dir, String name )
  {
    if ( name.startsWith( artifactId + "-" ) && name.endsWith( ".pom" ) )
    {
      String v = name.substring( artifactId.length() + 1, name.length() - 4 );
      v = VersionUtil.getBaseVersion( v );
      if ( v.equals( projectVersion ) )
      {
        return true;
      }
    }
    return false;
  }
}
origin: apache/archiva

String version;
String idSubStrFromVersion = id.substring( index );
if ( idSubStrFromVersion.startsWith( projectVersion ) && !VersionUtil.isUniqueSnapshot( projectVersion ) )
else if ( VersionUtil.isGenericSnapshot( projectVersion ) )
origin: apache/archiva

if ( !VersionUtil.isSnapshot( artifactRef.getVersion( ) ) )
      for ( String version : repoContent.getVersions( reference ) )
        if ( !VersionUtil.isSnapshot( version ) )
if ( releasedVersions.contains( VersionUtil.getReleaseVersion( artifactRef.getVersion( ) ) ) )
origin: org.apache.archiva/archiva-rest-services

VersionUtil.isSnapshot( artifact.getVersion() ) | VersionUtil.isGenericSnapshot( artifact.getVersion() );
  String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() );
  artifacts =
    metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
                          VersionUtil.getBaseVersion( artifact.getVersion() ) );
origin: apache/archiva

@Override
public boolean test( Path  dir )
{
  final String name = dir.getFileName().toString();
  if ( name.startsWith( artifactId + "-" ) && name.endsWith( ".pom" ) )
  {
    String v = name.substring( artifactId.length() + 1, name.length() - 4 );
    v = VersionUtil.getBaseVersion( v );
    if ( v.equals( projectVersion ) )
    {
      return true;
    }
  }
  return false;
}
origin: org.apache.archiva/maven2-repository

String version;
String idSubStrFromVersion = id.substring( index );
if ( idSubStrFromVersion.startsWith( projectVersion ) && !VersionUtil.isUniqueSnapshot( projectVersion ) )
else if ( VersionUtil.isGenericSnapshot( projectVersion ) )
origin: org.apache.archiva/archiva-core-consumers

if ( !VersionUtil.isSnapshot( artifactRef.getVersion() ) )
      for ( String version : repoContent.getVersions( reference ) )
        if ( !VersionUtil.isSnapshot( version ) )
if ( releasedVersions.contains( VersionUtil.getReleaseVersion( artifactRef.getVersion() ) ) )
origin: apache/archiva

if ( VersionUtil.isSnapshot( version ) )
origin: apache/archiva

public ArchivaArtifact( ArchivaArtifactModel artifactModel )
{
  this.model = artifactModel;
  model.setSnapshot( VersionUtil.isSnapshot( model.getVersion() ) );
  this.baseVersion = VersionUtil.getBaseVersion( model.getVersion() );
}

origin: org.apache.archiva/maven2-repository

public String toMetadataPath( VersionedReference reference )
{
  StringBuilder path = new StringBuilder();
  path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR );
  path.append( reference.getArtifactId() ).append( PATH_SEPARATOR );
  if ( reference.getVersion() != null )
  {
    // add the version only if it is present
    path.append( VersionUtil.getBaseVersion( reference.getVersion() ) ).append( PATH_SEPARATOR );
  }
  path.append( MAVEN_METADATA );
  return path.toString();
}
origin: apache/archiva

if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion( ) ) )
else if ( VersionUtil.isUniqueSnapshot( newArtifactReference.getVersion( ) ) )
origin: apache/archiva

public static boolean isSnapshot( String version )
{
  Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
  if ( m.matches() )
  {
    return true;
  }
  else
  {
    return isGenericSnapshot( version );
  }
}
origin: org.apache.archiva/maven2-repository

private boolean isProjectVersion( File dir )
{
  final String artifactId = dir.getParentFile().getName();
  final String projectVersion = dir.getName();
  // check if there is a POM artifact file to ensure it is a version directory
  File[] files;
  if ( VersionUtil.isSnapshot( projectVersion ) )
  {
    files = dir.listFiles( new PomFilenameFilter( artifactId, projectVersion ) );
  }
  else
  {
    final String pomFile = artifactId + "-" + projectVersion + ".pom";
    files = dir.listFiles( new PomFileFilter( pomFile ) );
  }
  if ( files != null && files.length > 0 )
  {
    return true;
  }
  // if a metadata file is present, check if this is the "version" directory, marking it as a project version
  ArchivaRepositoryMetadata metadata = readMetadata( dir );
  if ( metadata != null && projectVersion.equals( metadata.getVersion() ) )
  {
    return true;
  }
  return false;
}
origin: apache/archiva

if ( VersionUtil.isSnapshot( artifact.getVersion() ) )
  sb.append( '/' ).append( VersionUtil.getBaseVersion( artifact.getVersion() ) );
origin: apache/archiva

public String toPath( VersionedReference reference )
{
  StringBuilder path = new StringBuilder();
  path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR );
  path.append( reference.getArtifactId() ).append( PATH_SEPARATOR );
  if ( reference.getVersion() != null )
  {
    // add the version only if it is present
    path.append( VersionUtil.getBaseVersion( reference.getVersion() ) ).append( PATH_SEPARATOR );
  }
  path.append( MAVEN_METADATA );
  return path.toString();
}
org.apache.archiva.common.utilsVersionUtil

Javadoc

Version utility methods.

Most used methods

  • isSnapshot
  • getBaseVersion
  • isGenericSnapshot
  • isUniqueSnapshot
  • getReleaseVersion
    Get the release version of the snapshot version. If snapshot version is 1.0-SNAPSHOT, then releas
  • isVersion
    Tests if the unknown string contains elements that identify it as a version string (or not). The

Popular in Java

  • Running tasks concurrently on multiple threads
  • requestLocationUpdates (LocationManager)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now