From 9142511d48de704a3a4a2443c44a8184a4b4bdf7 Mon Sep 17 00:00:00 2001 From: Alexander Constantin Date: Sun, 2 Apr 2017 12:17:00 +0200 Subject: [PATCH] Issue #5 Use release style URL as fallback for snapshot artifacts Use release style URL as fallback for snapshot artifacts in case of information missing in maven-metadata.xml. Normally we require information about classifieres and most recent snapshot version to construct the download url --- gradle.properties | 2 +- .../apidocserver/service/RepositoryService.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5292141..590d2eb 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ group=com.rbmhtechnology name=apidoc-server -version=1.0.2 +version=1.0.3-SNAPSHOT javaVersion=1.8 # ######################################################################################### diff --git a/src/main/java/com/rbmhtechnology/apidocserver/service/RepositoryService.java b/src/main/java/com/rbmhtechnology/apidocserver/service/RepositoryService.java index e605f1b..ee7c518 100644 --- a/src/main/java/com/rbmhtechnology/apidocserver/service/RepositoryService.java +++ b/src/main/java/com/rbmhtechnology/apidocserver/service/RepositoryService.java @@ -370,7 +370,10 @@ private String getApidocFileNameFromMetadataXML(ArtifactIdentifier artifactIdent throw new RepositoryException("Could not parse maven-metadata.xml for '" + artifactIdentifier + "'", e); } - throw new RepositoryException("Could not determine snapshot apidoc file name!"); + // in case of a snapshot which has no reliable information coming from + // maven-metadata.xml simply use the pattern for releases + return artifactIdentifier.getArtifactId() + "-" + artifactIdentifier.getVersion() + "-" + + artifactIdentifier.getClassifier() + ".jar"; } /**