diff --git a/services/nexus/nexus.service.js b/services/nexus/nexus.service.js index d575173ead..462bbb9c92 100644 --- a/services/nexus/nexus.service.js +++ b/services/nexus/nexus.service.js @@ -187,11 +187,12 @@ module.exports = class Nexus extends BaseJsonService { return this.fetch3({ server, repo, groupId, artifactId, queryOpt }) } // Most servers still use Nexus 2. Fall back to Nexus 3 if the hitting a - // Nexus 2 endpoint returns a Bad Request (=> InvalidResponse). + // Nexus 2 endpoint returns a Bad Request (=> InvalidResponse, for path /service/local/artifact/maven/resolve) + // or a Not Found (for path /service/local/artifact/maven/resolve). try { return await this.fetch2({ server, repo, groupId, artifactId, queryOpt }) } catch (e) { - if (e instanceof InvalidResponse) { + if (e instanceof InvalidResponse || e instanceof NotFound) { return this.fetch3({ server, repo, groupId, artifactId, queryOpt }) } throw e diff --git a/services/nexus/nexus.tester.js b/services/nexus/nexus.tester.js index d0275d04c4..5e0e988c00 100644 --- a/services/nexus/nexus.tester.js +++ b/services/nexus/nexus.tester.js @@ -271,6 +271,18 @@ t.create('Nexus 3 - repository version') message: isVersion, }) +t.create( + 'Nexus 3 - repository version valid artifact without explicit nexusVersion parameter' +) + .timeout(15000) + .get( + '/proxy-public-3rd-party-release/com.fasterxml.jackson.core/jackson-databind.json?server=https://nexus.pentaho.org' + ) + .expectBadge({ + label: 'nexus', + message: isVersion, + }) + t.create('Nexus 3 - repository version with query') .get( `/proxy-public-3rd-party-release/org.junit.jupiter/junit-jupiter.json?server=https://nexus.pentaho.org&nexusVersion=3&queryOpt=${encodeURIComponent(