@Override public File resolve(CacheDescriptor cacheDescriptor) { LocalRepositoryManager manager = repositorySystemSession.getLocalRepositoryManager(); File localArtifact = new File( manager.getRepository().getBasedir(), manager.getPathForLocalArtifact(createArtifact(cacheDescriptor)) ); return localArtifact; }
String path = lrm.getPathForLocalArtifact( RepositoryUtils.toArtifact( artifact ) ); artifact.setFile( new File( lrm.getRepository().getBasedir(), path ) );
String path = lrm.getPathForLocalArtifact( artifactRequest.getArtifact() ); artifact.setFile( new File( lrm.getRepository().getBasedir(), path ) );
@Override public String getPathForLocalArtifact(final Artifact artifact) { return delegate.getPathForLocalArtifact(artifact); }
@Override public String getPathForLocalArtifact(final Artifact artifact) { return delegate.getPathForLocalArtifact(artifact); }
@Override public String getPathForLocalArtifact(final Artifact artifact) { return delegate.getPathForLocalArtifact(artifact); }
@Override public File resolve(CacheDescriptor cacheDescriptor) { LocalRepositoryManager manager = repositorySystemSession.getLocalRepositoryManager(); File localArtifact = new File( manager.getRepository().getBasedir(), manager.getPathForLocalArtifact(createArtifact(cacheDescriptor)) ); return localArtifact; }
public File getFile(Archive archive) { Artifact artifact = artifactBuilder.createArtifact(archive); LocalRepositoryManager manager = repositorySystemSession.getLocalRepositoryManager(); return new File(manager.getRepository().getBasedir(), manager.getPathForLocalArtifact(artifact)); } }
public FileNode getLocalRepositoryFile(Artifact artifact) { return getLocalRepositoryDir().join(repositorySession.getLocalRepositoryManager().getPathForLocalArtifact(artifact)); }
File dstFile = new File( lrm.getRepository().getBasedir(), lrm.getPathForLocalArtifact( artifact ) );
File dstFile = new File( lrm.getRepository().getBasedir(), lrm.getPathForLocalArtifact( targetArtifact ) );
protected Artifact resolve(final Artifact dep, final String classifier, final String type) { final LocalRepositoryManager lrm = repositorySystemSession.getLocalRepositoryManager(); final Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), classifier, type, dep.getVersion()); final File location = new File(lrm.getRepository().getBasedir(), lrm.getPathForLocalArtifact(artifact)); if (!location.exists()) { return resolve(artifact); } return artifact.setFile(location); }
session.setOffline( true ); String pathForLocalArtifact = localRepositoryManager.getPathForLocalArtifact(artifact);
session.setOffline( true ); String pathForLocalArtifact = localRepositoryManager.getPathForLocalArtifact(artifact);
String path = lrm.getPathForLocalArtifact(RepositoryUtils.toArtifact(artifact)); artifact.setFile(new File(lrm.getRepository().getBasedir(), path));
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); } }
return session.getLocalRepositoryManager().getPathForLocalArtifact( aetherArtifact ); return session.getLocalRepositoryManager().getPathForLocalArtifact( aetherArtifact );
File deleteTarget = new File(localRepositoryManager.getRepository().getBasedir(), localRepositoryManager.getPathForLocalArtifact(dependency.getArtifact()));
public static MavenArtifact getArtifactByAether(MavenArtifact a, File localRepository, boolean searchLocally) throws MavenException { Artifact artifact; RepositorySystem repositorySystem; RepositorySystemSession session; ArtifactRequest artifactRequest; try { repositorySystem = MavenRepositoryUtilities.newRepositorySystem(); session = MavenRepositoryUtilities.newSession(repositorySystem, localRepository); artifact = new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getClassifier(), a.getPackaging(), a.getVersion()); artifactRequest = new ArtifactRequest(); artifactRequest.setArtifact(artifact); List<RemoteRepository> repositories = MavenRepositoryUtilities.getEffectiveRepositories(session); artifactRequest.setRepositories(repositories); File localArtifactFile = new File(localRepository.getAbsolutePath() + File.separator + session.getLocalRepositoryManager().getPathForLocalArtifact(artifact)); if (!searchLocally || !localArtifactFile.exists()) { ArtifactResult artifactResult = repositorySystem.resolveArtifact(session, artifactRequest); artifact = artifactResult.getArtifact(); } else { MavenArtifact ret = new MavenArtifact(artifact); ret.setFile(localArtifactFile); return ret; } } catch (ArtifactResolutionException e) { throw new MavenException(e); } catch (SettingsBuildingException e) { throw new MavenException(e); } return new MavenArtifact(artifact); }