URL sourcesUrl = alternateUri != null ? new URL(alternateUri)
: M2ConventionsUtils.mavenRepoUrl(repoStr, sourcesArtifact);
Path sourcesDownloaded = downloadMaven(sourcesUrl, sourcesArtifact);
URL sourcesUrl = alternateUri != null ? new URL(alternateUri)
: M2ConventionsUtils.mavenRepoUrl(repoStr, sourcesArtifact);
Path sourcesDownloaded = downloadMaven(sourcesUrl, sourcesArtifact);
processM2SourceJar(sourcesDownloaded, targetBundleDir, merging ? artifact : null, unmodified);
logger.log(TRACE, () -> "Processed source " + sourcesDownloaded);
} catch (Exception e) {
processM2SourceJar(sourcesDownloaded, targetBundleDir, merging ? artifact : null, unmodified);
logger.log(TRACE, () -> "Processed source " + sourcesDownloaded);
} catch (Exception e) {
if (separateSources)
writer.append("Corresponding sources are available in the related archive named "
+ jarDir.toString() + ".src.jar.\n");
if (separateSources)
writer.append("Corresponding sources are available in the related archive named "
+ jarDir.toString() + ".src.jar.\n");
/** Append changes to the A2-ORIGIN/changes file. */
void appendChanges(Path baseDirectory) throws IOException {
/** Append changes to the A2-ORIGIN/changes file. */
void appendChanges(Path baseDirectory) throws IOException {
Path changesFile = baseDirectory.resolve(CHANGES);
Files.createDirectories(changesFile.getParent());
try (BufferedWriter writer = Files.newBufferedWriter(changesFile, APPEND, CREATE)) {
Path changesFile = baseDirectory.resolve(CHANGES);
Files.createDirectories(changesFile.getParent());
try (BufferedWriter writer = Files.newBufferedWriter(changesFile, APPEND, CREATE)) {