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


Java DefaultArtifactVersion类代码示例

本文整理汇总了Java中org.apache.maven.artifact.versioning.DefaultArtifactVersion的典型用法代码示例。如果您正苦于以下问题:Java DefaultArtifactVersion类的具体用法?Java DefaultArtifactVersion怎么用?Java DefaultArtifactVersion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultArtifactVersion类属于org.apache.maven.artifact.versioning包,在下文中一共展示了DefaultArtifactVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compareMavenVersionStrings

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
private int compareMavenVersionStrings(String dependencyVersionString, String duplicateVersionString) {
    String dependencyVersion = emptyToNull(dependencyVersionString);
    String duplicateVersion = emptyToNull(duplicateVersionString);
    if (dependencyVersion == null && duplicateVersion == null) {
        return 0;
    }
    if (dependencyVersion == null) {
        return -1;
    }
    if (duplicateVersion == null) {
        return 1;
    }
    ArtifactVersion dependencyArtifactVersion = new DefaultArtifactVersion(dependencyVersion);
    ArtifactVersion duplicateArtifactVersion = new DefaultArtifactVersion(duplicateVersion);
    return dependencyArtifactVersion.compareTo(duplicateArtifactVersion);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:DefaultPomDependenciesConverter.java

示例2: checkByCLIMavenValidationLevel

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
public static boolean checkByCLIMavenValidationLevel(ModelProblem problem) {
    // XXX HACK - this should be properly solved by upgrading the embeded maven
    String version = MavenSettings.getCommandLineMavenVersion();        
    try {
        if ( version != null && !"".equals(version.trim()) && 
             new DefaultArtifactVersion(version).compareTo(new DefaultArtifactVersion("3.2.1")) > 0) 
        {
            if ( (problem.getMessage().startsWith("'dependencies.dependency.exclusions.exclusion.groupId' for ") ||
                  problem.getMessage().startsWith("'dependencies.dependency.exclusions.exclusion.artifactId' for "))
                    && problem.getMessage().contains(" with value '*' does not match a valid id pattern")) 
            {
                return false;
            }
        }
    } catch (Throwable e) {
        // ignore and be optimistic about the hint
        LOG.log(Level.INFO, version, e);
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ModelUtils.java

示例3: validatePom

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
private Element validatePom()
    throws ParserConfigurationException, SAXException, IOException, CoreException {
  IFile pomXml = project.getFile("pom.xml");
  Element root = buildDocument(pomXml).getDocumentElement();
  Assert.assertEquals("project", root.getNodeName());
  Assert.assertEquals("http://maven.apache.org/POM/4.0.0", root.getNamespaceURI());
  Assert.assertEquals(
      "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd",
      root.getAttribute("xsi:schemaLocation"));

  Element groupId = (Element) root.getElementsByTagName("groupId").item(0);
  Assert.assertEquals("my.project.group.id", groupId.getTextContent());
  Element artifactId = (Element) root.getElementsByTagName("artifactId").item(0);
  Assert.assertEquals("my-project-artifact-id", artifactId.getTextContent());
  Element version = (Element) root.getElementsByTagName("version").item(0);
  Assert.assertEquals("98.76.54", version.getTextContent());
  
  Element pluginVersion =
      (Element) root.getElementsByTagName("appengine.maven.plugin.version").item(0);
  DefaultArtifactVersion artifactVersion =
      new DefaultArtifactVersion(pluginVersion.getTextContent());
  DefaultArtifactVersion expected = new DefaultArtifactVersion("1.3.2");
  Assert.assertTrue(artifactVersion.compareTo(expected) >= 0);
  return root;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:26,代码来源:CodeTemplatesTest.java

示例4: testTruncateVersionRange

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
@Test
public void testTruncateVersionRange() {
  ArtifactVersion initialVersion = majorVersion.getInitialVersion();
  ArtifactVersion newStart =
      new DefaultArtifactVersion(
          String.format(
              "%s.%s.%s",
              initialVersion.getMajorVersion(),
              initialVersion.getMajorVersion(),
              initialVersion.getIncrementalVersion() + 5));
  assumeTrue(majorVersion.getMaxVersion().compareTo(newStart) > 0);
  VersionRange updatedRange = MajorVersion.truncateAtLatest(newStart, majorVersion.getVersionRange());
  assertFalse(updatedRange.containsVersion(majorVersion.getInitialVersion()));
  ArtifactVersion afterStart =
      new DefaultArtifactVersion(
          String.format(
              "%s.%s.%s",
              initialVersion.getMajorVersion(),
              initialVersion.getMajorVersion(),
              initialVersion.getIncrementalVersion() + 6));
  if (majorVersion.hasStableApi()) {
    assertTrue(updatedRange.containsVersion(afterStart));
  } else {
    assertFalse(updatedRange.containsVersion(afterStart));
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:27,代码来源:MajorVersionTest.java

示例5: testGetLatestVersions

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
@Test
public void testGetLatestVersions() {
  ArtifactVersion latestVersionOne = new DefaultArtifactVersion("1.2.3");
  when(artifactRetriever.getLatestReleaseVersion(DataflowMavenCoordinates.GROUP_ID,
      DataflowMavenCoordinates.ARTIFACT_ID, MajorVersion.ONE.getVersionRange()))
      .thenReturn(latestVersionOne);
  ArtifactVersion latestVersionTwo = new DefaultArtifactVersion("2.0.0");
  when(artifactRetriever.getLatestReleaseVersion(DataflowMavenCoordinates.GROUP_ID,
      DataflowMavenCoordinates.ARTIFACT_ID, MajorVersion.TWO.getVersionRange()))
      .thenReturn(latestVersionTwo);

  Map<ArtifactVersion, MajorVersion> expected = ImmutableMap.of(
      latestVersionOne, MajorVersion.ONE,
      latestVersionTwo, MajorVersion.TWO);
  assertEquals(
      expected,
      manager.getLatestVersions(ImmutableSortedSet.of(MajorVersion.ONE, MajorVersion.TWO)));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:DataflowDependencyManagerTest.java

示例6: testGetLatestVersionUnstableWithStableVersionInMap

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
@Test
public void testGetLatestVersionUnstableWithStableVersionInMap() {
  ArtifactVersion latestQualified = new DefaultArtifactVersion("2.0.0-beta2");
  when(artifactRetriever.getLatestReleaseVersion(DataflowMavenCoordinates.GROUP_ID,
      DataflowMavenCoordinates.ARTIFACT_ID, MajorVersion.QUALIFIED_TWO.getVersionRange()))
      .thenReturn(latestQualified);
  ArtifactVersion latestMajor = new DefaultArtifactVersion("2.0.0");
  when(artifactRetriever.getLatestReleaseVersion(DataflowMavenCoordinates.GROUP_ID,
      DataflowMavenCoordinates.ARTIFACT_ID, MajorVersion.TWO.getVersionRange()))
      .thenReturn(latestMajor);

  assertEquals(
      Collections.singletonMap(latestMajor, MajorVersion.TWO),
      manager.getLatestVersions(
          ImmutableSortedSet.of(MajorVersion.QUALIFIED_TWO, MajorVersion.TWO)));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:17,代码来源:DataflowDependencyManagerTest.java

示例7: testGetLatestVersionUnstableWithNoStableVersion

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
@Test
public void testGetLatestVersionUnstableWithNoStableVersion() {
  ArtifactVersion latestOne = new DefaultArtifactVersion("1.9.0");
  when(artifactRetriever.getLatestReleaseVersion(DataflowMavenCoordinates.GROUP_ID,
      DataflowMavenCoordinates.ARTIFACT_ID, MajorVersion.ONE.getVersionRange()))
      .thenReturn(latestOne);
  ArtifactVersion latestQualifiedTwo = new DefaultArtifactVersion("2.0.0-beta2");
  when(artifactRetriever.getLatestReleaseVersion(DataflowMavenCoordinates.GROUP_ID,
      DataflowMavenCoordinates.ARTIFACT_ID, MajorVersion.QUALIFIED_TWO.getVersionRange()))
      .thenReturn(latestQualifiedTwo);

  Map<ArtifactVersion, MajorVersion> expected = ImmutableMap.of(
      latestOne, MajorVersion.ONE,
      latestQualifiedTwo, MajorVersion.QUALIFIED_TWO);
  assertEquals(
      expected,
      manager.getLatestVersions(
          ImmutableSortedSet.of(MajorVersion.ONE, MajorVersion.QUALIFIED_TWO)));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:DataflowDependencyManagerTest.java

示例8: evaluateVersion

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
public ArtifactVersion evaluateVersion()
{
  if (!isOSGiEngine(engineDir))
  {
    String absolutePath = engineDir == null ? "" : engineDir.getAbsolutePath();
    log.info("Can not evaluate version of a non-OSGi engine in directory '" + absolutePath + "'");
    return null;
  }

  String libraryFileName = getLibraryFileName(LIBRARY_ID);
  if (libraryFileName == null)
  {
    return null;
  }
  
  String version = StringUtils.substringAfter(libraryFileName, "_");
  return new DefaultArtifactVersion(toReleaseVersion(version));
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:19,代码来源:EngineVersionEvaluator.java

示例9: findEngineDownloadUrl

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
URL findEngineDownloadUrl(InputStream htmlStream) throws MojoExecutionException, MalformedURLException
{
  String engineFileNameRegex = "AxonIvyEngine[^.]+?\\.[^.]+?\\.+[^_]*?_"+osArchitecture+"\\.zip";
  Pattern enginePattern = Pattern.compile("href=[\"|'][^\"']*?"+engineFileNameRegex+"[\"|']");
  try(Scanner scanner = new Scanner(htmlStream))
  {
    String engineLink = null;
    while (StringUtils.isBlank(engineLink))
    {
      String engineLinkMatch = scanner.findWithinHorizon(enginePattern, 0);
      if (engineLinkMatch == null)
      {
        throw new MojoExecutionException("Could not find a link to engine for version '"+ivyVersion+"' on site '"+engineListPageUrl+"'");
      }
      String versionString = StringUtils.substringBetween(engineLinkMatch, "AxonIvyEngine", "_"+osArchitecture);
      ArtifactVersion version = new DefaultArtifactVersion(EngineVersionEvaluator.toReleaseVersion(versionString));
      if (getIvyVersionRange().containsVersion(version))
      {
        engineLink = StringUtils.replace(engineLinkMatch, "\"", "'");
        engineLink = StringUtils.substringBetween(engineLink, "href='", "'");
      }
    }
    return toAbsoluteLink(engineListPageUrl, engineLink);
  }
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:26,代码来源:InstallEngineMojo.java

示例10: checkForUpdate

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
public String checkForUpdate() {
    logger.finer("checkForUpdate");
    String result = null;
    final String current = getVersion();
    final String release = getLatestVersion();
    if (current != null && release != null) {
        logger.finer("Comparing current and release versions");
        final DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(current);
        final DefaultArtifactVersion releaseVersion = new DefaultArtifactVersion(release);
        final int compare = currentVersion.compareTo(releaseVersion);
        logger.finer("Comparing result is " + compare);
        if (compare != 0) {
            result = release;
        }
    }
    logger.finer("checkForUpdate result is " + result);
    return result;
}
 
开发者ID:paspiz85,项目名称:nanobot,代码行数:19,代码来源:BuildInfo.java

示例11: copySnapshot

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
static ArtifactVersion copySnapshot( ArtifactVersion source, ArtifactVersion destination )
{
    if ( isSnapshot( destination ) )
    {
        destination = stripSnapshot( destination );
    }
    Pattern matchSnapshotRegex = SNAPSHOT_PATTERN;
    final Matcher matcher = matchSnapshotRegex.matcher( source.toString() );
    if ( matcher.find() )
    {
        return new DefaultArtifactVersion( destination.toString() + "-" + matcher.group( 0 ) );
    }
    else
    {
        return new DefaultArtifactVersion( destination.toString() + "-SNAPSHOT" );
    }
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:18,代码来源:VersionComparators.java

示例12: getRequiredMavenVersion

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
private String getRequiredMavenVersion( MavenProject mavenProject, String defaultValue )
{
    ArtifactVersion requiredMavenVersion = null;
    while ( mavenProject != null )
    {
        final Prerequisites prerequisites = mavenProject.getPrerequisites();
        final String mavenVersion = prerequisites == null ? null : prerequisites.getMaven();
        if ( mavenVersion != null )
        {
            final ArtifactVersion v = new DefaultArtifactVersion( mavenVersion );
            if ( requiredMavenVersion == null || requiredMavenVersion.compareTo( v ) < 0 )
            {
                requiredMavenVersion = v;
            }
        }
        mavenProject = mavenProject.getParent();
    }
    return requiredMavenVersion == null ? defaultValue : requiredMavenVersion.toString();
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:20,代码来源:DisplayPluginUpdatesMojo.java

示例13: testSegmentIncrementing

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
public void testSegmentIncrementing()
    throws Exception
{
    assertEquals( new DefaultArtifactVersion( "6" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5" ), 0 ).toString() );
    assertEquals( new DefaultArtifactVersion( "6.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.0" ), 0 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.1" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.0" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.1.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.0.1" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.beta.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha.1" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.beta-0.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha-1.1" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.alpha-2.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha-1.1" ), 2 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.beta-0.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha-wins.1" ), 1 ).toString() );
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:21,代码来源:MercuryVersionComparatorTest.java

示例14: testSegmentIncrementing

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
public void testSegmentIncrementing()
    throws Exception
{
    assertEquals( new DefaultArtifactVersion( "6" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5" ), 0 ).toString() );
    assertEquals( new DefaultArtifactVersion( "6.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.0" ), 0 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.1" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.0" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.1.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.0.1" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.beta.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha.1" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.alpha-2.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha-1.1" ), 1 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.alpha-1.2" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha-1.1" ), 2 ).toString() );
    assertEquals( new DefaultArtifactVersion( "5.beta.0" ).toString(),
                  instance.incrementSegment( new DefaultArtifactVersion( "5.alpha-wins.1" ), 1 ).toString() );
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:21,代码来源:NumericVersionComparatorTest.java

示例15: shouldDecodeParams

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入依赖的package包/类
/**
 * For backward compatability, if the build info version is less or equals to 2.0.11
 * then we need to decode the request parameters since we used a different encoding technique in the past,
 * otherwise we simply let Jersey do the decoding for us
 *
 * @return True if we need to manually decode the request params, false otherwise
 */
public static boolean shouldDecodeParams(HttpServletRequest request) {
    String userAgent = request.getHeader(HttpHeaders.USER_AGENT);

    // If the request didn't come from build info let Jersey do the work
    if (StringUtils.isBlank(userAgent) || !userAgent.startsWith("ArtifactoryBuildClient/")) {
        return false;
    }

    String buildInfoVersion = StringUtils.removeStart(userAgent, "ArtifactoryBuildClient/");
    boolean snapshotCondition = StringUtils.contains(buildInfoVersion, "SNAPSHOT");
    boolean newVersionCondition = new DefaultArtifactVersion("2.0.11").compareTo(
            new DefaultArtifactVersion(buildInfoVersion)) < 0;

    // Build info version is SNAPSHOT or newer than 2.0.11 we also let Jersey do the work
    if (snapshotCondition || newVersionCondition) {
        return false;
    }

    // If we got here it means client is using an old build-info (<= 2.0.11) we must manually decode the http params
    return true;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:29,代码来源:RestUtils.java


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