當前位置: 首頁>>代碼示例>>Java>>正文


Java ArtifactResolutionException類代碼示例

本文整理匯總了Java中org.apache.maven.artifact.resolver.ArtifactResolutionException的典型用法代碼示例。如果您正苦於以下問題:Java ArtifactResolutionException類的具體用法?Java ArtifactResolutionException怎麽用?Java ArtifactResolutionException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ArtifactResolutionException類屬於org.apache.maven.artifact.resolver包,在下文中一共展示了ArtifactResolutionException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: downloadArchetype

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
@Messages("Handle_Download=Downloading Archetype")
private Artifact downloadArchetype(Archetype arch) throws ArtifactResolutionException, ArtifactNotFoundException {
    
    AggregateProgressHandle hndl = AggregateProgressFactory.createHandle(Handle_Download(),
            new ProgressContributor[] {
                AggregateProgressFactory.createProgressContributor("zaloha") },  //NOI18N
            ProgressTransferListener.cancellable(), null);
    synchronized (HANDLE_LOCK) {
       handle = hndl;
    }
    try {
        arch.resolveArtifacts(hndl);
    } finally {
        synchronized (HANDLE_LOCK) {//prevent store()/read() methods to call finish - issue 236251
            if (hndl == handle) {
                handle = null;
            }
        }
    }
    //#154913
    RepositoryIndexer.updateIndexWithArtifacts(RepositoryPreferences.getInstance().getLocalRepository(), Collections.singletonList(arch.getArtifact()));
    return arch.getArtifact();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:BasicPanelVisual.java

示例2: getArtifact

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的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: createArtifactResolutionResult

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
private ArtifactResolutionResult createArtifactResolutionResult( Collection<Artifact> artifacts, List<Artifact> missingArtifacts, ArtifactResolutionException exception, ArtifactFilter filter ) {
   ArtifactResolutionResult result = new ArtifactResolutionResult();
   Set<Artifact> strippedArtifacts = new HashSet<Artifact>( artifacts );
   if( OptionalArtifactFilter.INSTANCE.equals( filter ) ){
      Iterator<Artifact> artifactItr = strippedArtifacts.iterator();
      while( artifactItr.hasNext() ){
         boolean include = OptionalArtifactFilter.INSTANCE.include( artifactItr.next() );
         if( !include ){
            artifactItr.remove();
         }
      }
   }
   result.setArtifacts( new HashSet<Artifact>( strippedArtifacts ) );
   if( missingArtifacts != null ){
      result.setUnresolvedArtifacts( missingArtifacts );
   }
   if( exception != null ){
      result.addErrorArtifactException( exception );
   }
   return result;
}
 
開發者ID:ZsZs,項目名稱:FitNesseLauncher,代碼行數:22,代碼來源:FitNesseMojoTestHelper.java

示例4: execute

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    this.verifyProperties("module", "gameVersion", "mappingVersion", "sourceDirectory");

    this.getLog().info("Initializing repository at " + this.getSourceDirectory().getAbsolutePath());

    try {
        if (Files.notExists(this.getSourceDirectory().toPath()) || Files.notExists(this.getSourceDirectory().toPath().resolve(".git"))) {
            this.initializeRepository();
        } else {
            this.getLog().info("Skipping repository initialization - Cached");
        }

        this.getProject().addCompileSourceRoot(this.getSourceDirectory().toString());
    } catch (ArtifactResolutionException ex) {
        throw new MojoFailureException("Failed to resolve artifact: " + ex.getMessage(), ex);
    }
}
 
開發者ID:BasinMC,項目名稱:minecraft-maven-plugin,代碼行數:22,代碼來源:InitializeRepositoryMojo.java

示例5: execute

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    this.verifyProperties("module", "gameVersion", "mappingVersion");

    Artifact artifact = this.createArtifactWithClassifier(MINECRAFT_GROUP_ID, this.getModule(), this.getMappedArtifactVersion(), "source");
    this.getLog().info("Decompiling module " + this.getModule() + " with version " + this.getGameVersion() + " using MCP " + ("live".equals(this.getMappingVersion()) ? "live mappings" : "mapping version " + this.getMappingVersion()));

    try {
        if (!this.findArtifact(artifact).map((p) -> this.isSnapshotArtifactValid(artifact, p)).isPresent()) {
            this.populateSourceArtifact();
        } else {
            this.getLog().info("Skipping decompilation - Cached");
        }
    } catch (ArtifactResolutionException ex) {
        throw new MojoFailureException("Failed to resolve artifact: " + ex.getMessage(), ex);
    }
}
 
開發者ID:BasinMC,項目名稱:minecraft-maven-plugin,代碼行數:21,代碼來源:DecompileModuleMojo.java

示例6: execute

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    this.verifyProperties("module", "gameVersion", "mappingVersion");

    Artifact artifact = this.getMappedArtifact();
    this.getLog().info("Mapping module " + this.getModule() + " of version " + this.getGameVersion() + " against SRG " + this.getSrgVersion() + " and MCP " + ("live".equals(this.getMappingVersion()) ? "live mappings" : "version " + this.getMappingVersion()));

    try {
        if (!this.findArtifact(artifact).map((p) -> this.isSnapshotArtifactValid(artifact, p)).isPresent()) {
            this.populateMappedArtifact();
        } else {
            this.getLog().info("Skipping module mapping - Cached");
        }
    } catch (ArtifactResolutionException ex) {
        throw new MojoFailureException("Cannot resolve artifact: " + ex.getMessage(), ex);
    }
}
 
開發者ID:BasinMC,項目名稱:minecraft-maven-plugin,代碼行數:21,代碼來源:ApplyMappingsMojo.java

示例7: isInstalled

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
public boolean isInstalled(Log log, GitDependency dependency, Pom pom) throws MojoExecutionException {
	final GitDependencyHandler dependencyHandler = new GitDependencyHandler(dependency);
	final String version = dependencyHandler.getDependencyVersion(pom);
	final String type = dependencyHandler.getDependencyType(pom);
	final String classifier = dependencyHandler.getDependencyClassifier(pom);

	final Artifact artifact = factory.createArtifactWithClassifier(dependency.getGroupId(), dependency.getArtifactId(),
	                                                               version, type, classifier);
	try {
		artifactResolver.resolve(artifact, new ArrayList(), local);
	} catch (ArtifactResolutionException ex) {
		throw new MojoExecutionException(String.format("Failed to find artifact '%s.%s' in local repository.",
			dependency.getGroupId(), dependency.getArtifactId()), ex);
	} catch (ArtifactNotFoundException e) {
		return false;
	}

	return true;
}
 
開發者ID:ejwa,項目名稱:gitdep-maven-plugin,代碼行數:20,代碼來源:Resolver.java

示例8: getCompilerDependencies

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
private List<File> getCompilerDependencies( Artifact scalaCompilerArtifact, Artifact scalaLibraryArtifact )
    throws ArtifactNotFoundException, ArtifactResolutionException
{
    ArtifactFilter scalaLibraryFilter =
        new ExcludesArtifactFilter( Collections.singletonList( scalaLibraryArtifact.getGroupId() + ":"
            + scalaLibraryArtifact.getArtifactId() ) );
    List<File> d = new ArrayList<File>();
    for ( Artifact artifact : getAllDependencies( scalaCompilerArtifact, scalaLibraryFilter ) )
    {
        if ( !scalaCompilerArtifact.getGroupId().equals( artifact.getGroupId() )
            || !scalaCompilerArtifact.getArtifactId().equals( artifact.getArtifactId() ) )
        {
            d.add( artifact.getFile() ); // don't add scalaCompilerArtifact file
        }
    }
    return d;
}
 
開發者ID:sbt-compiler-maven-plugin,項目名稱:sbt-compiler-maven-plugin,代碼行數:18,代碼來源:AbstractSBTCompileMojo.java

示例9: resolveArtifacts

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
private void resolveArtifacts( List<Artifact> artifacts, String artifactGAVs )
    throws ArtifactNotFoundException, ArtifactResolutionException
{
    if ( artifactGAVs != null && artifactGAVs.trim().length() > 0 )
    {
        String[] scalacPluginsGAVs = artifactGAVs.trim().split( " " );
        for ( String scalacPluginGAV : scalacPluginsGAVs )
        {
            String[] gav = scalacPluginGAV.split( ":" );
            String groupId = gav[ 0 ];
            String artifactId = gav[ 1 ];
            String version = gav[ 2 ];
            Artifact scalacPluginArtifact = getResolvedArtifact( groupId, artifactId, version );
            if ( scalacPluginArtifact != null )
            {
                artifacts.add( scalacPluginArtifact );
            }
        }
    }
}
 
開發者ID:sbt-compiler-maven-plugin,項目名稱:sbt-compiler-maven-plugin,代碼行數:21,代碼來源:AbstractSBTCompileMojo.java

示例10: getDependencies

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
private List<File> getDependencies() throws MojoExecutionException {
    Set<Artifact> artifacts = new HashSet<>();
    String version = props.getProperty("version");
    String jettyVersion = props.getProperty("jettyVersion");

    getLog().info("Resolving dependencies for version " + version +" of jetty-console-core");

    artifacts.add(artifactFactory.createDependencyArtifact("org.simplericity.jettyconsole", "jetty-console-core", VersionRange.createFromVersion(version), "jar", null, "runtime"));

    List<File> artifactFiles = new ArrayList<File>();
    try {
        ArtifactResolutionResult result = resolver.resolveTransitively(artifacts, project.getArtifact(), remoteRepositories, localRepository, artifactMetadataSource);
        for(Artifact artifact : (Set<Artifact>) result.getArtifacts()) {
            artifactFiles.add(artifact.getFile());
        }
        return artifactFiles;

    } catch (ArtifactResolutionException | ArtifactNotFoundException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
}
 
開發者ID:eirbjo,項目名稱:jetty-console,代碼行數:22,代碼來源:CreateDescriptorMojo.java

示例11: getTransitiveDependencies

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
protected List getTransitiveDependencies( final Set previousArtifacts )
    throws ProjectBuildingException, InvalidDependencyVersionException, ArtifactResolutionException,
    ArtifactNotFoundException
{
    final List dependencies = new ArrayList();
    for ( Iterator iter = previousArtifacts.iterator(); iter.hasNext(); )
    {
        final Artifact a = (Artifact) iter.next();
        final Artifact pomArtifact =
            factory.createArtifact( a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getScope(), "pom" );
        final MavenProject pomProject =
            mavenProjectBuilder.buildFromRepository( pomArtifact, project.getRemoteArtifactRepositories(),
                                                     localRepository );
        final Set pomProjectArtifacts = pomProject.createArtifacts( factory, null, null );
        final ArtifactResolutionResult result =
            resolver.resolveTransitively( pomProjectArtifacts, pomArtifact, localRepository,
                                          project.getRemoteArtifactRepositories(), metadataSource, null );
        dependencies.addAll( result.getArtifacts() );
    }
    return dependencies;
}
 
開發者ID:mojohaus,項目名稱:clirr-maven-plugin,代碼行數:22,代碼來源:AbstractClirrMojo.java

示例12: resolve

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
private void resolve(
    Artifact artifact,
    List<ArtifactRepository> remoteRepositories,
    RepositorySystemSession session)
    throws ArtifactResolutionException, ArtifactNotFoundException {
  if (isModule(artifact)) {
    return;
  }
  try {
    resolveOrig(artifact, remoteRepositories, session);
  } catch (AbstractArtifactResolutionException e) {
    if (!failOnUnresolvedDependency) {
      artifact.setResolved(true);
    }
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:CheArtifactResolver.java

示例13: resolveTransitively

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively(
    Set<Artifact> artifacts,
    Artifact originatingArtifact,
    ArtifactRepository localRepository,
    List<ArtifactRepository> remoteRepositories,
    ArtifactMetadataSource source,
    ArtifactFilter filter)
    throws ArtifactResolutionException, ArtifactNotFoundException {
  return resolveTransitively(
      artifacts,
      originatingArtifact,
      Collections.EMPTY_MAP,
      localRepository,
      remoteRepositories,
      source,
      filter);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:18,代碼來源:CheArtifactResolver.java

示例14: run

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
public void run() {
  ClassLoader old = Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(classLoader);
    resolve(artifact, remoteRepositories, session);
  } catch (ArtifactNotFoundException anfe) {
    // These are cases where the artifact just isn't present in any of the remote repositories
    // because it wasn't deployed, or it was deployed in the wrong place.

    synchronized (result) {
      result.addMissingArtifact(artifact);
    }
  } catch (ArtifactResolutionException e) {
    // This is really a wagon TransferFailedException so something went wrong after we
    // successfully
    // retrieved the metadata.

    synchronized (result) {
      result.addErrorArtifactException(e);
    }
  } finally {
    latch.countDown();
    Thread.currentThread().setContextClassLoader(old);
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:26,代碼來源:CheArtifactResolver.java

示例15: isInstalled

import org.apache.maven.artifact.resolver.ArtifactResolutionException; //導入依賴的package包/類
public boolean isInstalled(Log log, GitDependency dependency, POM pom) {

        final GitDependencyHandler dependencyHandler = new GitDependencyHandler(dependency);

        String version = "";

        version = dependencyHandler.getDependencyVersion(pom);

        final String type = dependencyHandler.getDependencyType(pom);
        final String classifier = dependencyHandler.getDependencyClassifier(pom);

        final Artifact artifact = factory.createArtifactWithClassifier(dependency.getGroupId(), dependency
                .getArtifactId(),
                version, type, classifier);
        try {
            artifactResolver.resolve(artifact, new ArrayList(), local);
        } catch (ArtifactResolutionException ex) {
            throw new IllegalStateException("Failed to find artifact in local repository.", ex);
        } catch (ArtifactNotFoundException e) {
            return false;
        }

        return true;
    }
 
開發者ID:jr9999,項目名稱:maven-gitdep-plugin,代碼行數:25,代碼來源:Resolver.java


注:本文中的org.apache.maven.artifact.resolver.ArtifactResolutionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。