/** * A utility method to create a Maven artifact resource loader for the given artifact name. * * @param mavenResolver the Maven resolver to use (must not be {@code null}) * @param name the artifact name * @return the resource loader * @throws IOException if the artifact could not be resolved */ public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final String name) throws IOException { return createMavenArtifactLoader(mavenResolver, ArtifactCoordinates.fromString(name), name); }
/** * A utility method to create a Maven artifact resource loader for the given artifact name. * * @param name the artifact name * @return the resource loader * @throws IOException if the artifact could not be resolved */ public static ResourceLoader createMavenArtifactLoader(final String name) throws IOException { return createMavenArtifactLoader(MavenResolver.createDefaultResolver(), name); }
/** * Determine whether this coordinates object equals the target object. * * @param obj the target object * @return {@code true} if the object is equal to this one, {@code false} otherwise */ public boolean equals(final Object obj) { return this == obj || obj instanceof ArtifactCoordinates && equals((ArtifactCoordinates) obj); }
public ArtifactCoordinates mscCoordinates() { return new ArtifactCoordinates(this.groupId, this.artifactId, this.version, this.classifier == null ? "" : this.classifier); }
/** * Try to resolve a Maven JAR artifact. Calling this method is identical to calling * {@code resolveJarArtifact(qualifier, "jar")}. * * @param coordinates the non-{@code null} Maven coordinates object * @return the absolute path to the artifact, or {@code null} if none exists * @throws IOException if acquiring the artifact path failed for some reason */ default File resolveJarArtifact(final ArtifactCoordinates coordinates) throws IOException { return resolveArtifact(coordinates, "jar"); }
public File resolveArtifact(final ArtifactCoordinates coordinates, final String packaging) throws IOException { return doIo(() -> MavenArtifactUtil.resolveArtifact(coordinates, packaging), context); } }
public boolean canProxyFor(URL url) { for (NonProxyHost nonProxyHost : this.nonProxyHosts) { if (nonProxyHost.matches(url)) { return false; } } return true; }
public Proxy getProxyFor(URL url) { for (Proxy proxy : this.proxies) { if (proxy.canProxyFor(url)) { return proxy; } } return null; }
/** * Try to resolve a Maven JAR artifact. Calling this method is identical to calling * {@code resolveJarArtifact(qualifier, "jar")}. * * @param coordinates the non-{@code null} Maven coordinates object * @return the absolute path to the artifact, or {@code null} if none exists * @throws IOException if acquiring the artifact path failed for some reason */ public static File resolveJarArtifact(final ArtifactCoordinates coordinates) throws IOException { return resolveArtifact(coordinates, "jar"); }
/** * Create a relative repository path for the given artifact coordinates with a {@code '/'} separator. * * @return the path string */ public String relativeArtifactPath() { return relativeArtifactPath('/'); }
MavenSettings() { configureDefaults(); }
public ArtifactCoordinates mscCoordinates() { return new ArtifactCoordinates(this.groupId, this.artifactId, this.version, this.classifier == null ? "" : this.classifier); }
@Override public File resolveArtifact(ArtifactCoordinates coordinates, String packaging) throws IOException { for (MavenResolver resolver : this.resolvers) { File result = resolver.resolveArtifact(coordinates, packaging); if (result != null) { return result; } } return null; } }
/** * A utility method to create a Maven artifact resource loader for the given artifact name. * * @param mavenResolver the Maven resolver to use (must not be {@code null}) * @param name the artifact name * @return the resource loader * @throws IOException if the artifact could not be resolved */ public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final String name) throws IOException { return createMavenArtifactLoader(mavenResolver, ArtifactCoordinates.fromString(name), name); }
/** * A utility method to create a Maven artifact resource loader for the given artifact name. * * @param name the artifact name * @return the resource loader * @throws IOException if the artifact could not be resolved */ public static ResourceLoader createMavenArtifactLoader(final String name) throws IOException { return createMavenArtifactLoader(MavenResolver.createDefaultResolver(), name); }
/** * Determine whether this coordinates object equals the target object. * * @param obj the target object * @return {@code true} if the object is equal to this one, {@code false} otherwise */ public boolean equals(final Object obj) { return this == obj || obj instanceof ArtifactCoordinates && equals((ArtifactCoordinates) obj); }
public boolean canProxyFor(URL url) { for (NonProxyHost nonProxyHost : this.nonProxyHosts) { if (nonProxyHost.matches(url)) { return false; } } return true; }
public Proxy getProxyFor(URL url) { for (Proxy proxy : this.proxies) { if (proxy.canProxyFor(url)) { return proxy; } } return null; }
/** * Try to resolve a Maven JAR artifact. Calling this method is identical to calling * {@code resolveJarArtifact(qualifier, "jar")}. * * @param coordinates the non-{@code null} Maven coordinates object * @return the absolute path to the artifact, or {@code null} if none exists * @throws IOException if acquiring the artifact path failed for some reason */ public static File resolveJarArtifact(final ArtifactCoordinates coordinates) throws IOException { return resolveArtifact(coordinates, "jar"); }
/** * Create a relative repository path for the given artifact coordinates with a {@code '/'} separator. * * @return the path string */ public String relativeArtifactPath() { return relativeArtifactPath('/'); }