本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
示例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;
}