Collection<String> excludes) throws RepositoryException { Artifact artifact = new DefaultArtifact(dependency); DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter =
static org.apache.maven.artifact.DefaultArtifact getArtifact(String coords) { DefaultArtifact aetherArtifact = new DefaultArtifact(coords); return new org.apache.maven.artifact.DefaultArtifact(aetherArtifact.getGroupId(), aetherArtifact.getArtifactId(), aetherArtifact.getVersion(), null, aetherArtifact.getExtension(), aetherArtifact.getClassifier(), null) { // The DefaultArtifact created here is only used internally as a // vehicle. Since we do not set a scope and an artifact handler // these methods cannot work in a reasonable way. Instead returning // null which might lead to problems later on we throw an // exception right when the corresponding methods are called. @Override public String getScope() { throw new UnsupportedOperationException(); } @Override public ArtifactHandler getArtifactHandler() { throw new UnsupportedOperationException(); } }; } }
public String getBaseVersion() { if ( baseVersion == null ) { baseVersion = toBaseVersion( getVersion() ); } return baseVersion; }
public boolean isSnapshot() { return isSnapshot( getVersion() ); }
/** * Filters by adding an implicit version "${project.dm.version}" if none provided. * * @param context filtering context. Cannot be null. * @param value value to be filtered. Cannot be null. * @return filtered value */ public String filter(final Map<String, String> context, final String value) { String filtered = checkNotNull(value); try { final DefaultArtifact artifact = new DefaultArtifact(value + ":${project.dm.version}"); if ("${project.dm.version}".equals(artifact.getVersion())) { filtered = value + ":${project.dm.version}"; } } catch (IllegalArgumentException ignore) { // do nothing } return filtered; }
public Artifact setProperties( Map<String, String> properties ) { if ( this.properties.equals( properties ) || ( properties == null && this.properties.isEmpty() ) ) { return this; } return new DefaultArtifact( groupId, artifactId, classifier, extension, version, file, copy( properties ) ); }
Artifact artifact = new DefaultArtifact(groupId, artifactId, extension, version).setFile(file);
private List<ArtifactResult> fetchArtifactWithDep(Dependency dep) throws DependencyResolutionException, ArtifactResolutionException { Artifact artifact = new DefaultArtifact(dep.getGroupArtifactVersion()); DependencyFilter classpathFilter = DependencyFilterUtils .classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter( dep.getExclusions()); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new org.sonatype.aether.graph.Dependency(artifact, JavaScopes.COMPILE)); collectRequest.addRepository(mavenCentral); collectRequest.addRepository(mavenLocal); for (Repository repo : repositories) { RemoteRepository rr = new RemoteRepository(repo.getId(), "default", repo.getUrl()); rr.setPolicy(repo.isSnapshot(), null); collectRequest.addRepository(rr); } DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter)); return system.resolveDependencies(session, dependencyRequest).getArtifactResults(); }
final DefaultArtifact artifact; try { artifact = new DefaultArtifact(value); if (!dependency.getGroupId().equalsIgnoreCase(artifact.getGroupId())) { continue; if (!dependency.getArtifactId().equalsIgnoreCase(artifact.getArtifactId())) { continue; extensionToCompare = "jar"; if (!extensionToCompare.equals(artifact.getExtension())) { continue; classifierToCompare = ""; if (!classifierToCompare.equals(artifact.getClassifier())) { continue;
@Override protected DefaultArtifact constructArtifact(final String groupId, final String artifactId, final String classifier, final String packaging, final String version) { return new DefaultArtifact(groupId, artifactId, classifier, packaging, version); } }
private static Artifact artifactFromCoords(String coords) { return new DefaultArtifact(coords); }
private Artifact toArtifact(GAV gav) { return new DefaultArtifact(gav.groupId, gav.artifactId, "jar", gav.version); }
/** * Creates a new artifact with the specified coordinates, properties and file. * * @param groupId The group identifier of the artifact, may be {@code null}. * @param artifactId The artifact identifier of the artifact, may be {@code null}. * @param classifier The classifier of the artifact, may be {@code null}. * @param extension The file extension of the artifact, may be {@code null}. * @param version The version of the artifact, may be {@code null}. * @param properties The properties of the artifact, may be {@code null} if none. The method may assume immutability * of the supplied map. * @param file The resolved file of the artifact, may be {@code null}. */ protected Artifact newInstance( String groupId, String artifactId, String classifier, String extension, String version, Map<String, String> properties, File file ) { return new DefaultArtifact( groupId, artifactId, classifier, extension, version, file, properties ); }
public Artifact setFile( File file ) { if ( ( this.file == null ) ? file == null : this.file.equals( file ) ) { return this; } return new DefaultArtifact( groupId, artifactId, classifier, extension, version, file, properties ); }
public Artifact setVersion( String version ) { if ( this.version.equals( version ) || ( version == null && this.version.length() <= 0 ) ) { return this; } return new DefaultArtifact( groupId, artifactId, classifier, extension, version, file, properties ); }
org.sonatype.aether.artifact.Artifact resolveSideArtifact(final org.apache.maven.artifact.Artifact mainArtifact, final String classifier, final String type) throws SideArtifactNotFoundException { return resolveSideArtifact(new DefaultArtifact(mainArtifact.getGroupId(), mainArtifact.getArtifactId(), null, null, mainArtifact.getVersion()), classifier, type); }
private Artifact asArtifact() { getURL(); return new DefaultArtifact(groupId, artifactId, classifier, type, version); }
public DependencyTreeResult collectDependencies(String groupId, String artifactId, String version, String extension, String classifier, boolean offline, Filter<Dependency> excludeDependencyFilter) throws RepositoryException, IOException { DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, classifier, extension, version); return collectDependencies(artifact, version, offline, excludeDependencyFilter); }
public DependencyTreeResult collectDependencies(String groupId, String artifactId, String version, String extension, String classifier, boolean offline, Filter<Dependency> excludeDependencyFilter) throws RepositoryException, ArtifactResolutionException, IOException, XmlPullParserException { DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, classifier, extension, version); return collectDependencies(artifact, version, offline, excludeDependencyFilter); }
private static Artifact getArtifact(String coordinate) { return new DefaultArtifact(resolveVersion(coordinate)); }