private List<File> loadFromMvn(String artifact, Collection<String> excludes) throws RepositoryException { Collection<String> allExclusions = new LinkedList<>(); allExclusions.addAll(excludes); allExclusions.addAll(Arrays.asList(exclusions)); List<ArtifactResult> listOfArtifact; listOfArtifact = getArtifactsWithDep(artifact, allExclusions); Iterator<ArtifactResult> it = listOfArtifact.iterator(); while (it.hasNext()) { Artifact a = it.next().getArtifact(); String gav = a.getGroupId() + ":" + a.getArtifactId() + ":" + a.getVersion(); for (String exclude : allExclusions) { if (gav.startsWith(exclude)) { it.remove(); break; } } } List<File> files = new LinkedList<>(); for (ArtifactResult artifactResult : listOfArtifact) { files.add(artifactResult.getArtifact().getFile()); logger.debug("load {}", artifactResult.getArtifact().getFile().getAbsolutePath()); } return files; }
public String getGroupId() { return delegate.getGroupId(); }
public Key( Artifact artifact ) { this.artifact = artifact; int hash = 17; hash = hash * 31 + artifact.getGroupId().hashCode(); hash = hash * 31 + artifact.getArtifactId().hashCode(); hashCode = hash; }
static String pathOf( final Artifact artifact ) { final StringBuilder path = new StringBuilder( 128 ); path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' ); path.append( artifact.getArtifactId() ).append( '/' ); path.append( artifact.getBaseVersion() ).append( '/' ); path.append( nameOf( artifact ) ); return path.toString(); }
private String getConflictId( Artifact artifact ) { StringBuilder buffer = new StringBuilder( 128 ); buffer.append( artifact.getGroupId() ); buffer.append( ':' ).append( artifact.getArtifactId() ); buffer.append( ':' ).append( artifact.getExtension() ); if ( artifact.getClassifier().length() > 0 ) { buffer.append( ':' ).append( artifact.getClassifier() ); } return buffer.toString(); }
@Override public int hashCode() { int hash = 17; hash = hash * 31 + artifact.getArtifactId().hashCode(); hash = hash * 31 + artifact.getGroupId().hashCode(); hash = hash * 31 + artifact.getClassifier().hashCode(); hash = hash * 31 + artifact.getExtension().hashCode(); return hash; }
@Override public boolean accept(final DependencyNode node, final List<DependencyNode> parents) { final Dependency dependency = node.getDependency(); if (dependency == null) { return false; } final String groupId = dependency.getArtifact().getGroupId(); final boolean accept = groupId.startsWith(prefix); return accept; }
/** * {@inheritDoc} * * @see org.apache.maven.mae.project.session.ProjectToolsSession#getReactorProject(org.sonatype.aether.artifact.Artifact) */ @Override public MavenProject getReactorProject( final Artifact artifact ) { final String id = key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion() ); return reactorProjects.get( id ); }
public File findArtifact( Artifact artifact ) { String projectKey = artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getVersion(); MavenProject project = projectsByGAV.get( projectKey ); if ( project != null ) { return find( project, artifact ); } return null; }
public String getPathForLocalArtifact( Artifact artifact ) { String artifactId = artifact.getArtifactId(); String groupId = artifact.getGroupId(); String extension = artifact.getExtension(); String version = artifact.getVersion(); String classifier = artifact.getClassifier(); String path = String.format( "%s/%s/%s/%s-%s-%s%s.%s", groupId, artifactId, version, groupId, artifactId, version, classifier, extension ); return path; }
private DefaultArtifact getSideArtifact(final org.sonatype.aether.artifact.Artifact mainArtifact, final String classifier, String type) { return new DefaultArtifact(mainArtifact.getGroupId(), mainArtifact.getArtifactId(), classifier, type, mainArtifact.getVersion()); } }
@Override public String toString() { return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getClassifier() + ':' + artifact.getExtension(); }
public String getPathForLocalArtifact( Artifact artifact ) { String artifactId = artifact.getArtifactId(); String groupId = artifact.getGroupId(); String extension = artifact.getExtension(); String version = artifact.getVersion(); String classifier = artifact.getClassifier(); String path = String.format( "%s/%s/%s/%s-%s-%s%s.%s", groupId, artifactId, version, groupId, artifactId, version, classifier, extension ); return path; }
private String getId( Artifact a ) { return a.getGroupId() + ':' + a.getArtifactId() + ':' + a.getClassifier() + ':' + a.getExtension(); }
@Override public boolean matches(Dependency dependencyTree) { Artifact artifact = dependencyTree.getArtifact(); String groupId = artifact.getGroupId(); String artifactId = artifact.getArtifactId(); return groupFilter.matches(groupId) && artifactFilter.matches(artifactId); }
@Override public boolean matches(Dependency dependencyTree) { Artifact artifact = dependencyTree.getArtifact(); String groupId = artifact.getGroupId(); String artifactId = artifact.getArtifactId(); return groupFilter.matches(groupId) && artifactFilter.matches(artifactId); }
public static DependencyId newInstance(Artifact artifact) { return new DependencyId(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension()); }
public File findArtifact(org.sonatype.aether.artifact.Artifact artifact) { return WorkspaceState2.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(), artifact.getClassifier(), artifact.getBaseVersion()); }
private MavenBundle(Artifact artifact, boolean forceVersionAsInProject) { groupId(artifact.getGroupId()); artifactId(artifact.getArtifactId()); type(artifact.getExtension()); classifier(artifact.getClassifier()); if (!forceVersionAsInProject) version(artifact.getVersion()); }
private Artifact getDependencyArtifact( Dependency dep ) { org.sonatype.aether.artifact.Artifact artifact = dep.getArtifact(); return factory.createDependencyArtifact( artifact.getGroupId(), artifact.getArtifactId(), VersionRange.createFromVersion( artifact.getVersion() ), artifact.getProperty( "type", artifact.getExtension() ), artifact.getClassifier(), dep.getScope(), dep.isOptional() ); }