/** * 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); }
public File resolveArtifact(final ArtifactCoordinates coordinates, final String packaging) throws IOException { return doIo(() -> MavenArtifactUtil.resolveArtifact(coordinates, packaging), context); } }
try { String remotePomPath = remoteRepository + artifactRelativeHttpPath + ".pom"; downloadFile(coordinates + ":" + packaging, remotePomPath, pomFile); if (pomFile.exists()) { //download successful return pomFile; try { String remoteMetadataPath = remoteRepository + artifactRelativeMetadataHttpPath; timestampedArtifactRelativePath = coordinates.relativeArtifactPath('/', downloadTimestampVersion(coordinates + ":" + packaging, remoteMetadataPath)); String remotePomPath = remoteRepository + timestampedArtifactRelativePath + ".pom"; downloadFile(coordinates + ":" + packaging, remotePomPath, pomFile); if (pomFile.exists()) { //download successful return pomFile; String remotePomPath = remoteRepository + artifactRelativeHttpPath + ".pom"; String remoteArtifactPath = remoteRepository + artifactRelativeHttpPath + classifier + "." + packaging; downloadFile(coordinates + ":pom", remotePomPath, pomFile); if (!pomFile.exists()) { downloadFile(coordinates + ":" + packaging, remoteArtifactPath, artifactFile); if (artifactFile.exists()) { //download successful return artifactFile; try { String remoteMetadataPath = remoteRepository + artifactRelativeMetadataHttpPath; timestampedArtifactRelativePath = coordinates.relativeArtifactPath('/', downloadTimestampVersion(coordinates + ":" + packaging, remoteMetadataPath)); String remotePomPath = remoteRepository + timestampedArtifactRelativePath + ".pom"; String remoteArtifactPath = remoteRepository + timestampedArtifactRelativePath + classifier + "." + packaging; downloadFile(coordinates + ":pom", remotePomPath, pomFile);
/** * 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"); }
MavenArtifactUtil.downloadFile(artifactCoordinates + ":pom", artifactAbsoluteHttpPath + "pom", targetArtifactPomFile); } catch (IOException e) { Module.getModuleLogger().trace(e, "Could not doDownload '%s' from '%s' repository", artifactRelativeHttpPath, remoteRepos); MavenArtifactUtil.downloadFile(artifactCoordinates + ":" + packaging, artifactAbsoluteHttpPath + packaging, targetArtifactFile); if (targetArtifactFile.exists()) { return targetArtifactFile;
return mavenSettings; return mavenSettings = doIo(() -> { MavenSettings settings = new MavenSettings();
String remoteMetadataPath = remoteRepos + artifactRelativeMetadataHttpPath; try { String timestamp = MavenArtifactUtil.downloadTimestampVersion(artifactCoordinates + ":" + packaging, remoteMetadataPath);
/** * 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"); }
try { String remotePomPath = remoteRepository + artifactRelativeHttpPath + ".pom"; downloadFile(coordinates + ":" + packaging, remotePomPath, pomFile); if (pomFile.exists()) { //download successful return pomFile; String remotePomPath = remoteRepository + artifactRelativeHttpPath + ".pom"; String remoteArtifactPath = remoteRepository + artifactRelativeHttpPath + classifier + "." + packaging; downloadFile(coordinates + ":pom", remotePomPath, pomFile); if (! pomFile.exists()) { downloadFile(coordinates + ":" + packaging, remoteArtifactPath, artifactFile); if (artifactFile.exists()) { //download successful return artifactFile;
return mavenSettings; return mavenSettings = doIo(() -> { MavenSettings settings = new MavenSettings();
/** * 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); }
/** * 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); }