@Override public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } File pomFile = pomArtifact.getFile(); return new FileModelSource( pomFile ); }
throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e ); throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { File pomFile = null; if ( modelPool != null ) { pomFile = modelPool.get( groupId, artifactId, version ); } if ( pomFile == null ) { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } pomFile = pomArtifact.getFile(); } return new FileModelSource( pomFile ); }
"Error resolving project artifact: " + e.getMessage(), e );
/** * Creates a new exception with the specified results. * * @param results The resolution results at the point the exception occurred, may be {@code null}. */ public ArtifactResolutionException( List<ArtifactResult> results ) { super( getMessage( results ), getCause( results ) ); this.results = ( results != null ) ? results : Collections.<ArtifactResult> emptyList(); }
/** * Creates a new exception with the specified results. * * @param results The resolution results at the point the exception occurred, may be {@code null}. */ public ArtifactResolutionException( List<ArtifactResult> results ) { super( getMessage( results ), getCause( results ) ); this.results = ( results != null ) ? results : Collections.<ArtifactResult>emptyList(); }
private ArtifactResult resolveArtifactRequest(ArtifactRequest request) { ArtifactResult result = null; try { result = system.resolveArtifact(session, request); } catch (ArtifactResolutionException e) { LOG.warn("Cannot resolve artifact: " + request.getArtifact()); if (LOG.isDebugEnabled()) LOG.debug(e.getMessage(), e); } return result; }
public Artifact resolveArtifact(Artifact inputArtifact) throws MojoExecutionException { ArtifactRequest request = new ArtifactRequest(); request.setArtifact( inputArtifact ); request.setRepositories( remoteRepos ); try { return repoSystem.resolveArtifact( repoSession, request ).getArtifact(); } catch (ArtifactResolutionException e) { throw new MojoExecutionException( e.getMessage(), e ); } }
protected Artifact resolve(final Artifact art) { final ArtifactRequest artifactRequest = new ArtifactRequest().setArtifact(art).setRepositories(remoteRepositories); try { final ArtifactResult result = repositorySystem.resolveArtifact(repositorySystemSession, artifactRequest); if (result.isMissing()) { throw new IllegalStateException("Can't find " + art); } return result.getArtifact(); } catch (final ArtifactResolutionException e) { throw new IllegalStateException(e.getMessage(), e); } } }
protected File resolveArtifact(Artifact artifact) throws MojoExecutionException, DependencyCollectionException { ArtifactRequest request = new ArtifactRequest(); request.setArtifact(artifact); request.setRepositories(remoteRepos); ArtifactResult result; try { result = repositorySystem.resolveArtifact(repoSession, request); } catch (ArtifactResolutionException e) { throw new MojoExecutionException(e.getMessage(), e); } return result.getArtifact().getFile(); }
public WarFile resolve() throws IOException { String version; if (artifact.getVersion().equals("@latest")) { try { version = maven.latestRelease(artifact); } catch (VersionRangeResolutionException e) { throw new IOException(e); } artifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), "war", version); } try { return new WarFile(maven.resolve(artifact)); } catch (ArtifactResolutionException e) { throw (IOException) new FileNotFoundException("Artifact " + artifact + " not found: " + e.getMessage()).initCause(e); } }
private File resolve(final String group, final String artifact, final String version, final String classifier) { final DefaultArtifact art = new DefaultArtifact(group, artifact, classifier, "jar", version); final ArtifactRequest artifactRequest = new ArtifactRequest().setArtifact(art).setRepositories(remoteRepositories); final LocalRepositoryManager lrm = session.getLocalRepositoryManager(); art.setFile(new File(lrm.getRepository().getBasedir(), lrm.getPathForLocalArtifact(artifactRequest.getArtifact()))); try { final ArtifactResult result = repositorySystem.resolveArtifact(session, artifactRequest); if (result.isMissing()) { throw new IllegalStateException("Can't find commons-cli, please add it to the pom."); } return result.getArtifact().getFile(); } catch (final ArtifactResolutionException e) { throw new IllegalStateException(e.getMessage(), e); } }
/** * Find a specific artifact in a remote repository * * @param desiredArtifact The artifact that we want to find * @return Will return an ArtifactResult object * @throws DependencyResolutionException */ private Artifact getArtifactResult(Artifact desiredArtifact) throws DependencyResolutionException {// NOSONAR ArtifactRequest artifactRequest = new ArtifactRequest(); artifactRequest.setArtifact(desiredArtifact); artifactRequest.setRepositories(repositoryList); try { return repositorySystem.resolveArtifact(repositorySystemSession, artifactRequest).getArtifact(); } catch (ArtifactResolutionException e) { throw new DependencyResolutionException(e.getMessage(), e); } }
@Override public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "", "pom", version); try { final ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, null); pomArtifact = system.resolveArtifact(session, request).getArtifact(); } catch (ArtifactResolutionException e) { throw new UnresolvableModelException("Failed to resolve POM for " + groupId + ":" + artifactId + ":" + version + " due to " + e.getMessage(), groupId, artifactId, version, e); } final File pomFile = pomArtifact.getFile(); return new FileModelSource(pomFile); }
@Override public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "", "pom", version); try { final ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, null); pomArtifact = system.resolveArtifact(session, request).getArtifact(); } catch (ArtifactResolutionException e) { throw new UnresolvableModelException("Failed to resolve POM for " + groupId + ":" + artifactId + ":" + version + " due to " + e.getMessage(), groupId, artifactId, version, e); } final File pomFile = pomArtifact.getFile(); return new FileModelSource(pomFile); }
public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "", "pom", version); try { ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, context); request.setTrace(trace); pomArtifact = resolver.resolveArtifact(session, request).getArtifact(); } catch (ArtifactResolutionException e) { throw new UnresolvableModelException(e.getMessage(), groupId, artifactId, version, e); } File pomFile = pomArtifact.getFile(); return new FileModelSource(pomFile); }
@Override public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "", "pom", version); try { final ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, null); pomArtifact = system.resolveArtifact(session, request).getArtifact(); } catch (ArtifactResolutionException e) { throw new UnresolvableModelException("Failed to resolve POM for " + groupId + ":" + artifactId + ":" + version + " due to " + e.getMessage(), groupId, artifactId, version, e); } final File pomFile = pomArtifact.getFile(); return new FileModelSource(pomFile); }
public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } File pomFile = pomArtifact.getFile(); return new FileModelSource( pomFile ); }
@Override public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } File pomFile = pomArtifact.getFile(); return new FileModelSource( pomFile ); }
public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } File pomFile = pomArtifact.getFile(); return new FileModelSource( pomFile ); }