本文整理汇总了Java中org.apache.maven.artifact.versioning.OverConstrainedVersionException类的典型用法代码示例。如果您正苦于以下问题:Java OverConstrainedVersionException类的具体用法?Java OverConstrainedVersionException怎么用?Java OverConstrainedVersionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OverConstrainedVersionException类属于org.apache.maven.artifact.versioning包,在下文中一共展示了OverConstrainedVersionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReplacement
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
private Artifact getReplacement(Artifact artifact) {
String key = String.format("%s/%s", artifact.getGroupId(), artifact.getArtifactId());
String bundle = null;
for (VersionRange range : translations.get(key).keySet()) {
try {
if (range.containsVersion(artifact.getSelectedVersion())) {
bundle = translations.get(key).get(range);
break;
}
} catch (OverConstrainedVersionException e) {
bundle = null;
}
}
if (bundle != null) {
String[] split = bundle.split("/");
return factory.createArtifact(split[0], split[1], split[2], Artifact.SCOPE_PROVIDED, artifact.getArtifactHandler().getPackaging());
} else {
return null;
}
}
示例2: resolveConflict
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
{
try
{
ArtifactVersion version1 = node1.getArtifact().getSelectedVersion();
ArtifactVersion version2 = node2.getArtifact().getSelectedVersion();
return version1.compareTo( version2 ) <= 0 ? node1 : node2;
}
catch ( OverConstrainedVersionException exception )
{
// TODO: log message or throw exception?
return null;
}
}
示例3: resolveConflict
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
{
try
{
ArtifactVersion version1 = node1.getArtifact().getSelectedVersion();
ArtifactVersion version2 = node2.getArtifact().getSelectedVersion();
return version1.compareTo( version2 ) > 0 ? node1 : node2;
}
catch ( OverConstrainedVersionException exception )
{
// TODO: log message or throw exception?
return null;
}
}
示例4: testOverConstrainedVersionException
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public void testOverConstrainedVersionException()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
ArtifactSpec a = createArtifactSpec( "a", "1.0" );
a.addDependency( "b", "[1.0, 2.0)" );
a.addDependency( "c", "[3.3.0,4.0.0)" );
ArtifactSpec b = createArtifactSpec( "b", "1.0.0" );
b.addDependency( "c", "3.3.0-v3346" );
ArtifactSpec c = createArtifactSpec( "c", "3.2.1-v3235e" );
try
{
ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact } ) );
}
catch ( OverConstrainedVersionException e )
{
assertTrue( "Versions unordered", e.getMessage().indexOf( "[3.2.1-v3235e, 3.3.0-v3346]" ) != -1 );
assertTrue( "DependencyTrail unresolved", e.getMessage().indexOf( "Path to dependency:" ) != -1 );
}
}
示例5: addDependencies
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public void addDependencies( Set<Artifact> artifacts, List<ArtifactRepository> remoteRepositories,
ArtifactFilter filter )
throws CyclicDependencyException, OverConstrainedVersionException
{
if ( artifacts != null && !artifacts.isEmpty() )
{
children = new ArrayList<ResolutionNode>( artifacts.size() );
for ( Artifact a : artifacts )
{
if ( parents.contains( a.getDependencyConflictId() ) )
{
a.setDependencyTrail( getDependencyTrail() );
throw new CyclicDependencyException( "A dependency has introduced a cycle", a );
}
children.add( new ResolutionNode( a, remoteRepositories, this ) );
}
}
else
{
children = Collections.emptyList();
}
trail = null;
}
示例6: filterTrail
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public boolean filterTrail( ArtifactFilter filter )
throws OverConstrainedVersionException
{
boolean success = true;
if ( filter != null )
{
for ( Artifact artifact : getTrail() )
{
if ( !filter.include( artifact ) )
{
success = false;
}
}
}
return success;
}
示例7: getSelectedVersion
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
private static ArtifactVersion getSelectedVersion( Artifact artifact )
throws MojoExecutionException
{
try
{
return artifact.getSelectedVersion();
}
catch ( OverConstrainedVersionException ex )
{
throw new MojoExecutionException( ex.getMessage(), ex );
}
}
示例8: getDependencyTrail
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
/**
* @return {@link List} < {@link String} > with artifact ids
* @throws OverConstrainedVersionException
*/
public List<String> getDependencyTrail()
throws OverConstrainedVersionException
{
List<Artifact> trial = getTrail();
List<String> ret = new ArrayList<String>( trial.size() );
for ( Artifact artifact : trial )
{
ret.add( artifact.getId() );
}
return ret;
}
示例9: getTrail
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
private List<Artifact> getTrail()
throws OverConstrainedVersionException
{
if ( trail == null )
{
List<Artifact> ids = new LinkedList<Artifact>();
ResolutionNode node = this;
while ( node != null )
{
Artifact artifact = node.getArtifact();
if ( artifact.getVersion() == null )
{
// set the recommended version
ArtifactVersion selected = artifact.getSelectedVersion();
// MNG-2123: null is a valid response to getSelectedVersion, don't
// assume it won't ever be.
if ( selected != null )
{
artifact.selectVersion( selected.toString() );
}
else
{
throw new OverConstrainedVersionException( "Unable to get a selected Version for "
+ artifact.getArtifactId(), artifact );
}
}
ids.add( 0, artifact );
node = node.parent;
}
trail = ids;
}
return trail;
}
示例10: getSelectedVersion
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
@Override
public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException
{
// TODO Auto-generated method stub
return null;
}
示例11: isSelectedVersionKnown
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
@Override
public boolean isSelectedVersionKnown() throws OverConstrainedVersionException
{
// TODO Auto-generated method stub
return false;
}
示例12: getSelectedVersion
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException {
return myWrapee.getSelectedVersion();
}
示例13: isSelectedVersionKnown
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public boolean isSelectedVersionKnown() throws OverConstrainedVersionException {
return myWrapee.isSelectedVersionKnown();
}
示例14: getComparisonArtifact
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
private Artifact getComparisonArtifact()
throws MojoFailureException, MojoExecutionException
{
// Find the previous version JAR and resolve it, and it's dependencies
VersionRange range;
try
{
range = VersionRange.createFromVersionSpec( comparisonVersion );
}
catch ( InvalidVersionSpecificationException e )
{
throw new MojoFailureException( "Invalid comparison version: " + e.getMessage() );
}
Artifact previousArtifact;
try
{
previousArtifact = factory.createDependencyArtifact( project.getGroupId(), project.getArtifactId(), range,
project.getPackaging(), null, Artifact.SCOPE_COMPILE );
if ( !previousArtifact.getVersionRange().isSelectedVersionKnown( previousArtifact ) )
{
getLog().debug( "Searching for versions in range: " + previousArtifact.getVersionRange() );
List availableVersions = metadataSource.retrieveAvailableVersions( previousArtifact, localRepository,
project.getRemoteArtifactRepositories() );
filterSnapshots( availableVersions );
ArtifactVersion version = range.matchVersion( availableVersions );
if ( version != null )
{
previousArtifact.selectVersion( version.toString() );
}
}
}
catch ( OverConstrainedVersionException e1 )
{
throw new MojoFailureException( "Invalid comparison version: " + e1.getMessage() );
}
catch ( ArtifactMetadataRetrievalException e11 )
{
throw new MojoExecutionException( "Error determining previous version: " + e11.getMessage(), e11 );
}
if ( previousArtifact.getVersion() == null )
{
getLog().info( "Unable to find a previous version of the project in the repository" );
}
return previousArtifact;
}
示例15: getSelectedVersion
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; //导入依赖的package包/类
public ArtifactVersion getSelectedVersion()
throws OverConstrainedVersionException
{
throw new RuntimeException( "Not implemented" );
}