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


Java InvalidVersionSpecificationException类代码示例

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


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

示例1: getDataflowVersionRange

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public VersionRange getDataflowVersionRange(IProject project) {
  Model model = getModelFromProject(project);
  if (model != null) {
    Dependency dependency = getDataflowDependencyFromModel(model);
    if (dependency != null) {
      String version = dependency.getVersion();
      if (!Strings.isNullOrEmpty(version)) {
        try {
          return VersionRange.createFromVersionSpec(version);
        } catch (InvalidVersionSpecificationException ex) {
          String message =
              String.format("Could not create version range from existing version %s", version);
          throw new IllegalStateException(message, ex);
        }
      }
    }
  }
  return allVersions();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:DataflowDependencyManager.java

示例2: getArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
protected Artifact getArtifact(ArtifactItem artifactItem) throws MojoExecutionException, InvalidVersionSpecificationException {
   Artifact artifact;
	
   VersionRange vr = VersionRange.createFromVersionSpec(artifactItem.getVersion());
	
   if (StringUtils.isEmpty(artifactItem.getClassifier())) {
       artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
                                                    artifactItem.getType(), null, Artifact.SCOPE_COMPILE );
   } else {
       artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
                                                    artifactItem.getType(), artifactItem.getClassifier(),
                                                    Artifact.SCOPE_COMPILE );
   }
	
   try {
	resolver.resolve(artifact, remoteRepos, local);
} catch (ArtifactResolutionException | ArtifactNotFoundException e) {
	throw new MojoExecutionException("Error resolving artifact "+artifact, e);
}
   
   return artifact;
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:23,代码来源:SchemaDistMojo.java

示例3: createManagedVersionMap

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
/**
 *
 * @param projectId
 * @param dependencyManagement
 * @return
 * @throws ProjectBuildingException
 */
private Map createManagedVersionMap(String projectId, DependencyManagement dependencyManagement) throws ProjectBuildingException {
    Map map;
    if (dependencyManagement != null && dependencyManagement.getDependencies() != null) {
        map = new HashMap();
        for (Dependency d : dependencyManagement.getDependencies()) {
            try {
                VersionRange versionRange = VersionRange.createFromVersionSpec(d.getVersion());
                Artifact artifact = factory.createDependencyArtifact(d.getGroupId(), d.getArtifactId(),
                        versionRange, d.getType(), d.getClassifier(),
                        d.getScope());
                map.put(d.getManagementKey(), artifact);
            } catch (InvalidVersionSpecificationException e) {
                throw new ProjectBuildingException(projectId, "Unable to parse version '" + d.getVersion()
                        + "' for dependency '" + d.getManagementKey() + "': " + e.getMessage(), e);
            }
        }
    } else {
        map = Collections.EMPTY_MAP;
    }
    return map;
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:29,代码来源:ConfluenceDeployMojo.java

示例4: getIvyVersionRange

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
protected final VersionRange getIvyVersionRange() throws MojoExecutionException
{
  try
  {
    VersionRange ivyVersionRange = VersionRange.createFromVersionSpec(ivyVersion);
    if (ivyVersionRange.getRecommendedVersion() != null)
    {
      ivyVersionRange = VersionRange.createFromVersionSpec("["+ivyVersion+"]");
    }
    
    if (restrictVersionToMinimalCompatible)
    {
      return restrictToMinimalCompatible(ivyVersionRange);
    }
    return ivyVersionRange;
  }
  catch (InvalidVersionSpecificationException ex)
  {
    throw new MojoExecutionException("Invalid ivyVersion '"+ivyVersion+"'.", ex);
  }
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:22,代码来源:AbstractEngineMojo.java

示例5: isVersionOverlap

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
/**
 * Checks if two versions or ranges have an overlap.
 *
 * @param leftVersionOrRange the 1st version number or range to test
 * @param rightVersionOrRange the 2nd version number or range to test
 * @return true if both versions have an overlap
 * @throws InvalidVersionSpecificationException if the versions can't be parsed to a range
 */
public static boolean isVersionOverlap( String leftVersionOrRange, String rightVersionOrRange )
    throws InvalidVersionSpecificationException
{
    VersionRange pomVersionRange = createVersionRange( leftVersionOrRange );
    if ( !pomVersionRange.hasRestrictions() )
    {
        return true;
    }

    VersionRange oldVersionRange = createVersionRange( rightVersionOrRange );
    if ( !oldVersionRange.hasRestrictions() )
    {
        return true;
    }

    VersionRange result = oldVersionRange.restrict( pomVersionRange );
    return result.hasRestrictions();
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:27,代码来源:PomHelper.java

示例6: toArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
/**
 * Try to find the dependency artifact that matches the given dependency.
 *
 * @param dependency
 * @return
 * @since 1.0-alpha-3
 */
protected Artifact toArtifact( Dependency dependency )
    throws MojoExecutionException
{
    Artifact artifact = findArtifact( dependency );
    if ( artifact == null )
    {
        try
        {
            return getHelper().createDependencyArtifact( dependency );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
    }
    return artifact;
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:25,代码来源:AbstractVersionsDependencyUpdaterMojo.java

示例7: lookupDependenciesUpdates

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Map<Dependency, ArtifactVersions> lookupDependenciesUpdates( Set dependencies,
                                                                    boolean usePluginRepositories )
    throws ArtifactMetadataRetrievalException, InvalidVersionSpecificationException
{
    Map<Dependency, ArtifactVersions> dependencyUpdates =
        new TreeMap<Dependency, ArtifactVersions>( new DependencyComparator() );
    for ( Object dependency1 : dependencies )
    {
        Dependency dependency = (Dependency) dependency1;

        ArtifactVersions details = lookupDependencyUpdates( dependency, usePluginRepositories );
        dependencyUpdates.put( dependency, details );
    }
    return dependencyUpdates;
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:19,代码来源:DefaultVersionsHelper.java

示例8: isVersionOverlap

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
/**
 * Checks if two versions or ranges have an overlap.
 *
 * @param leftVersionOrRange  the 1st version number or range to test
 * @param rightVersionOrRange the 2nd version number or range to test
 * @return true if both versions have an overlap
 * @throws InvalidVersionSpecificationException
 *          if the versions can't be parsed to a range
 */
public static boolean isVersionOverlap( String leftVersionOrRange, String rightVersionOrRange )
    throws InvalidVersionSpecificationException
{
    VersionRange pomVersionRange = createVersionRange( leftVersionOrRange );
    if ( !pomVersionRange.hasRestrictions() )
    {
        return true;
    }

    VersionRange oldVersionRange = createVersionRange( rightVersionOrRange );
    if ( !oldVersionRange.hasRestrictions() )
    {
        return true;
    }

    VersionRange result = oldVersionRange.restrict( pomVersionRange );
    return result.hasRestrictions();
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:28,代码来源:PomHelper.java

示例9: getArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
protected Artifact getArtifact(ArtifactItem artifactItem) throws MojoExecutionException, InvalidVersionSpecificationException {
   Artifact artifact;

   VersionRange vr = VersionRange.createFromVersionSpec(artifactItem.getVersion());

   if (StringUtils.isEmpty(artifactItem.getClassifier())) {
       artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
                                                    artifactItem.getType(), null, Artifact.SCOPE_COMPILE );
   } else {
       artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
                                                    artifactItem.getType(), artifactItem.getClassifier(),
                                                    Artifact.SCOPE_COMPILE );
   }

   try {
	resolver.resolve(artifact, remoteRepos, local);
} catch (ArtifactResolutionException | ArtifactNotFoundException e) {
	throw new MojoExecutionException("Error resolving artifact "+artifact, e);
}

   return artifact;
  }
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:23,代码来源:SchemaDistMojo.java

示例10: createPluginArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public Artifact createPluginArtifact( Plugin plugin )
{
    VersionRange versionRange;
    try
    {
        String version = plugin.getVersion();
        if ( StringUtils.isEmpty( version ) )
        {
            version = "RELEASE";
        }
        versionRange = VersionRange.createFromVersionSpec( version );
    }
    catch ( InvalidVersionSpecificationException e )
    {
        return null;
    }

    return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:LegacyRepositorySystem.java

示例11: disabledtestCircularDependencyNotIncludingCurrentProject

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public void disabledtestCircularDependencyNotIncludingCurrentProject()
    throws ArtifactResolutionException, InvalidVersionSpecificationException
{
    ArtifactSpec a = createArtifactSpec( "a", "1.0" );
    ArtifactSpec b = a.addDependency( "b", "1.0" );
    b.addDependency( "a", "1.0" );
    try
    {
        collect( a );
        fail( "Should have failed on cyclic dependency not involving project" );
    }
    catch ( CyclicDependencyException expected )
    {
        assertTrue( true );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:DefaultArtifactCollectorTest.java

示例12: disabledtestCircularDependencyIncludingCurrentProject

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public void disabledtestCircularDependencyIncludingCurrentProject()
    throws ArtifactResolutionException, InvalidVersionSpecificationException
{
    ArtifactSpec a = createArtifactSpec( "a", "1.0" );
    ArtifactSpec b = a.addDependency( "b", "1.0" );
    b.addDependency( "project", "1.0" );
    try
    {
        collect( a );
        fail( "Should have failed on cyclic dependency involving project" );
    }
    catch ( CyclicDependencyException expected )
    {
        assertTrue( true );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:DefaultArtifactCollectorTest.java

示例13: testResolveWithFilter

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public void testResolveWithFilter()
    throws ArtifactResolutionException, InvalidVersionSpecificationException
{
    ArtifactSpec a = createArtifactSpec( "a", "1.0" );
    ArtifactSpec b = a.addDependency( "b", "1.0" );
    ArtifactSpec c = a.addDependency( "c", "3.0" );

    b.addDependency( "c", "2.0" );
    ArtifactSpec d = b.addDependency( "d", "4.0" );

    ArtifactResolutionResult res = collect( a );
    assertEquals( "Check artifact list",
                  createSet( new Object[] { a.artifact, b.artifact, c.artifact, d.artifact } ), res.getArtifacts() );

    ArtifactFilter filter = new ExclusionSetFilter( new String[] { "b" } );
    res = collect( a, filter );
    assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, c.artifact } ), res.getArtifacts() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:DefaultArtifactCollectorTest.java

示例14: testResolveCorrectDependenciesWhenDifferentDependenciesOnNearest

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public void testResolveCorrectDependenciesWhenDifferentDependenciesOnNearest()
    throws ArtifactResolutionException, InvalidVersionSpecificationException
{
    ArtifactSpec a = createArtifactSpec( "a", "1.0" );
    ArtifactSpec b = a.addDependency( "b", "1.0" );
    ArtifactSpec c2 = b.addDependency( "c", "2.0" );
    c2.addDependency( "d", "1.0" );

    ArtifactSpec e = createArtifactSpec( "e", "1.0" );
    ArtifactSpec c1 = e.addDependency( "c", "1.0" );
    ArtifactSpec f = c1.addDependency( "f", "1.0" );

    ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, e.artifact } ) );
    assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, e.artifact, c1.artifact,
        f.artifact } ), res.getArtifacts() );
    assertEquals( "Check version", "1.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:DefaultArtifactCollectorTest.java

示例15: disabledtestResolveCorrectDependenciesWhenDifferentDependenciesOnNewest

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入依赖的package包/类
public void disabledtestResolveCorrectDependenciesWhenDifferentDependenciesOnNewest()
    throws ArtifactResolutionException, InvalidVersionSpecificationException
{
    // TODO: use newest conflict resolver
    ArtifactSpec a = createArtifactSpec( "a", "1.0" );
    ArtifactSpec b = a.addDependency( "b", "1.0" );
    ArtifactSpec c2 = b.addDependency( "c", "2.0" );
    ArtifactSpec d = c2.addDependency( "d", "1.0" );

    ArtifactSpec e = createArtifactSpec( "e", "1.0" );
    ArtifactSpec c1 = e.addDependency( "c", "1.0" );
    c1.addDependency( "f", "1.0" );

    ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, e.artifact } ) );
    assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, e.artifact, c2.artifact,
        d.artifact } ), res.getArtifacts() );
    assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:DefaultArtifactCollectorTest.java


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