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


Java ArtifactNotFoundException類代碼示例

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


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

示例1: downloadArchetype

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

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

示例4: getCompilerDependencies

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

示例5: resolveArtifacts

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

示例6: getDependencies

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

示例7: getTransitiveDependencies

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

示例8: resolve

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

示例9: resolveTransitively

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

示例10: run

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

示例11: isInstalled

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

示例12: getArtifact

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

示例13: resolveEpisodeArtifacts

import org.apache.maven.artifact.resolver.ArtifactNotFoundException; //導入依賴的package包/類
protected void resolveEpisodeArtifacts()
		throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException {
	this.episodeArtifacts = new LinkedHashSet<Artifact>();
	{
		final Collection<Artifact> episodeArtifacts = ArtifactUtils.resolve(getArtifactFactory(),
				getArtifactResolver(), getLocalRepository(), getArtifactMetadataSource(), getEpisodes(),
				getProject());
		this.episodeArtifacts.addAll(episodeArtifacts);
	}
	{
		if (getUseDependenciesAsEpisodes()) {
			@SuppressWarnings("unchecked")
			final Collection<Artifact> projectArtifacts = getProject().getArtifacts();
			final AndArtifactFilter filter = new AndArtifactFilter();
			filter.add(new ScopeArtifactFilter(DefaultArtifact.SCOPE_COMPILE));
			filter.add(new TypeArtifactFilter("jar"));
			for (Artifact artifact : projectArtifacts) {
				if (filter.include(artifact)) {
					this.episodeArtifacts.add(artifact);
				}
			}
		}
	}
	this.episodeFiles = ArtifactUtils.getFiles(this.episodeArtifacts);
}
 
開發者ID:highsource,項目名稱:maven-jaxb2-plugin,代碼行數:26,代碼來源:RawXJC2Mojo.java

示例14: resolve

import org.apache.maven.artifact.resolver.ArtifactNotFoundException; //導入依賴的package包/類
public static Collection<Artifact> resolve(
		final ArtifactFactory artifactFactory,
		final ArtifactResolver artifactResolver,
		final ArtifactRepository localRepository,
		final ArtifactMetadataSource artifactMetadataSource,
		final Dependency[] dependencies, final MavenProject project)
		throws InvalidDependencyVersionException,
		ArtifactResolutionException, ArtifactNotFoundException {
	if (dependencies == null) {
		return Collections.emptyList();
	}

	@SuppressWarnings("unchecked")
	final Set<Artifact> artifacts = MavenMetadataSource.createArtifacts(
			artifactFactory, Arrays.asList(dependencies), "runtime", null,
			project);

	for (Artifact artifact : artifacts) {
		artifactResolver.resolve(artifact,

		project.getRemoteArtifactRepositories(), localRepository);
	}

	final Set<Artifact> resolvedArtifacts = artifacts;
	return resolvedArtifacts;
}
 
開發者ID:highsource,項目名稱:maven-jaxb2-plugin,代碼行數:27,代碼來源:ArtifactUtils.java

示例15: readBundles

import org.apache.maven.artifact.resolver.ArtifactNotFoundException; //導入依賴的package包/類
private void readBundles() throws IOException, ArtifactResolutionException, ArtifactNotFoundException {        
    BufferedReader reader = null;
    try {
        if (bundles != null) {
            getLog().info("Step 2 : Building a list of exports for bundles in " + bundles.getAbsolutePath());
            reader = new BufferedReader(new FileReader(bundles));
            String line = reader.readLine();
            while (line != null) {
                if (line.contains("/") && !line.startsWith("#")) {
                    String[] elements = line.split("/");
                    Artifact artifact = factory.createArtifact(elements[0], elements[1], elements[2], Artifact.SCOPE_PROVIDED,
                                                               elements[3]);
                    registerBundle(artifact);
                }
                line = reader.readLine();
            }                
        } else {
            getLog().info("Step 2 : No Bundle file supplied for building list of exports");
        }
    } finally {
        if (reader != null) {
            reader.close();
        }
    }
    getLog().info("...done!");
}
 
開發者ID:hitakaken,項目名稱:bigfoot-maven-plugins,代碼行數:27,代碼來源:GenerateFeaturesXmlMojo.java


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