:clipboard: Description
Nexus badges don't work (show "artifact not found") with Nexus 3, even if it has the "NXRM2 style URIs" capability enabled.
This is probably because Nexus 3 has had a major overhaul of its REST API. The new API seems to support our use case. For example, a request like this to our self-hosted Nexus 3 instance:
$ curl -u user:pass -X GET "http://nexus.example.com/service/rest/v1/search?sort=version&repository=public&group=org.slf4j&name=slf4j-api" -H "accept: application/json"
yields this:
Output
{
"items" : [ {
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmI2YzZlZjk3OTZkYWM4MzA0ZWJkYmUxN2JmMGFiMTM",
"repository" : "spring-milestones",
"format" : "maven2",
"group" : "org.slf4j",
"name" : "slf4j-api",
"version" : "1.8.0-beta4",
"assets" : [ {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar",
"path" : "org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YTQ3NTdiY2FhNjJiNjMwNmUyNDAyMjcwNmU2NTdhNDA",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "83b0359d847ee053d745be7ec0d8e9e8a44304b4",
"md5" : "e8147675316a5bc78d1ba5d8cdb9e578"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6ZDZlNGE1MGFiYTNjOGExOTBkNTk0ZGFiOTI4NDExODU",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "a8dbd7d0219300504b1dbb745b06d237ff820a3a",
"md5" : "fb4bcf72e6dc807a6dcbdebc6bb889fe"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.pom",
"path" : "org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.pom",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmU3NjU5YzQ4Yjg2OGFkNDQ0OTY0MjY4OGJmZDQ4MDU",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "0bbd45e9c4e1384fb96d3f0d32494d7d02668fb5",
"md5" : "db31efff7324bfa2d595451f617d7f5a"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.pom.sha1",
"path" : "org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.pom.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6ODUwYzgwZjYxYzk0MDJlN2JiZDk2YTk3YTljOTk1YjE",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "6ff1c8f882905286f2284b702b05bbbff7234387",
"md5" : "13ced8d0a7fdc5e6ebd3deac3ac05bf0"
}
} ]
}, {
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6Zjg5OGIzOTAzY2I5OWM1OTUyZTMyYmNjM2M5MjFjNmQ",
"repository" : "spring-milestones",
"format" : "maven2",
"group" : "org.slf4j",
"name" : "slf4j-api",
"version" : "1.7.28",
"assets" : [ {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-javadoc.jar",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-javadoc.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YTQ3NTdiY2FhNjJiNjMwNmU0ZGU4YmY3MzJiYTEwNjM",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "e70c28747173e53d680f268d021916e684235953",
"md5" : "89570ffb082eda201ffd50e1f278f413"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-javadoc.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-javadoc.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MjRjMWZlMzM1ZDI2NjUyZmVhOGU2N2IxMDI2N2I3Yzk",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "ec0a6aa49f0c57484ced36e60a07a35f42f566ef",
"md5" : "ae720339d13e38b2609c613f255cc596"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-sources.jar",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-sources.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MjRjMWZlMzM1ZDI2NjUyZmU0MTgxMzExMWM2MDkyYzY",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "6444f3c8fce32e20f621e264807256c5e65f11c9",
"md5" : "f265e4f098277b34e33c3c2e429bf05f"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-sources.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28-sources.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmU3NjU5YzQ4Yjg2OGFkNGVkMWZiZTk4ZTRhZTk4ODA",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "317709ca15a130e929d8d77cf14a7c5657f15f16",
"md5" : "5ee5c4d6974407045d82e9d410fe3bdb"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.jar",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmU3NjU5YzQ4Yjg2OGFkNDRiOWYyM2YwNjVmMmU4ODg",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "2cd9b264f76e3d087ee21bfc99305928e1bdb443",
"md5" : "1468c816e659d8013027d912863dc865"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MmZmZjUwOWE3YzJhOWViZWVjYTI2NTMyOTExZWVhMTc",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "2b97429f72765cb5dee8c8587f8d58855cd344f3",
"md5" : "3a237523b0854cb992fdcb69e147bb25"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.pom",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.pom",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MmZmZjUwOWE3YzJhOWViZWZhZmM5OWIxZDYyNDU1Nzc",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "cd719d9023e40888f24b9d2556a2aad034b92203",
"md5" : "9f3143b70210714beae6be00e436cd19"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.pom.sha1",
"path" : "org/slf4j/slf4j-api/1.7.28/slf4j-api-1.7.28.pom.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NDhjN2E2NzlhYTY3OTc2YjMwOWQ1N2FjZGRmOTljZjE",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "9f14c48474d171f48a5ace29f800654e4259288f",
"md5" : "8126ea7ff2fd8696df2feb8c9f63e514"
}
} ]
}, {
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6Zjg5OGIzOTAzY2I5OWM1OWQ3OTA1NDY4M2QyZTM5NDk",
"repository" : "spring-milestones",
"format" : "maven2",
"group" : "org.slf4j",
"name" : "slf4j-api",
"version" : "1.7.26",
"assets" : [ {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-javadoc.jar",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-javadoc.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MjRjMWZlMzM1ZDI2NjUyZmZhN2I3ZTZiNWU5NDBmMTM",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "83863db711c68b9d5542c5fa0cd801b7035281d7",
"md5" : "d35c4b8eaa7f7dbe3cc7b474902983ae"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-javadoc.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-javadoc.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YTQ3NTdiY2FhNjJiNjMwNjczYjkzZjU5NGExYzUxZDg",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "34a2fe48c02d4dfaa8f8b13086977f6fb8294b92",
"md5" : "5debf830459684cbaf431d48640f3176"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-sources.jar",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-sources.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmYwYmNmZjMzOWJlZWYwNmRhM2M4N2ZkNDRiYmIxYjQ",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "021c84cdf9da108216b5e402611d4af479b60cb8",
"md5" : "d208882740e2c4a971dbdec6d48b757b"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-sources.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26-sources.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MjRjMWZlMzM1ZDI2NjUyZmM2MjlkMTc0YTRlZGY3Nzg",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "50169964c3f1f07e3f6a4831a89b6faebbf8eb84",
"md5" : "69f77699ef8696b8833c7fd087e17513"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NDhjN2E2NzlhYTY3OTc2Yjg1NzkyMGM5ZjQ1MDZkODM",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "77100a62c2e6f04b53977b9f541044d7d722693d",
"md5" : "60ec8751be37d54a2aa1b6178f87b968"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NDhjN2E2NzlhYTY3OTc2YjJkNGI1OTE1MjAzNGU1MGI",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "445665e3c0491025680c9249090dc17642c35f0c",
"md5" : "ee5399830ce3dc1610b4b9bf19589114"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.pom",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.pom",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MmZmZjUwOWE3YzJhOWViZWNmZGE1MDVjYzhhYzk1N2Y",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "4d3419a58d77c07f49185aaa556a787d50508d27",
"md5" : "d1b34b4f8ee2feadc81c38781eb1d5ed"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.pom.sha1",
"path" : "org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.pom.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NDhjN2E2NzlhYTY3OTc2YmQyZGMxYzc3MTMzZjcxMzc",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "d8f45ccfdc07e94a5ec6bce7c58e6a2869bf7d90",
"md5" : "d5b641d9b61a40a7b4b670a94d867c9d"
}
} ]
}, {
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6ZDA2NDgwNGE4ZWQ1YWQ2ZTBjZTg3OGExZDVjZGE0M2M",
"repository" : "spring-milestones",
"format" : "maven2",
"group" : "org.slf4j",
"name" : "slf4j-api",
"version" : "1.7.25",
"assets" : [ {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-javadoc.jar",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-javadoc.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MjRjMWZlMzM1ZDI2NjUyZjE4OTM0OGNiODljYTVlNDY",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "f003e89ddebdbaca5cf3fc7cc0c67c88c2ca1a3c",
"md5" : "91d00b2a20f993a225aa5d58000b5913"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-javadoc.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-javadoc.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YTQ3NTdiY2FhNjJiNjMwNmYwZTJkZjVjMjBjMjRlYmQ",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "1bb012053cab87431f38f070bfc0ef0494b12a2e",
"md5" : "fdd9d2da0852b154e138a1fd5dc429ba"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-sources.jar",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-sources.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6MmZmZjUwOWE3YzJhOWViZWY0NDZmZDQzYjQyNjU2YjQ",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "962153db4a9ea71b79d047dfd1b2a0d80d8f4739",
"md5" : "6ad0f63b2eaac80e1db9c36235e5db0b"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-sources.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-sources.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmYwYmNmZjMzOWJlZWYwNmJjOTA3OTRhMjJlNzhjNjg",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "a32b3e2c22c5122b0fb11b9032966e22e4b4b98d",
"md5" : "d616e34a02a7d085919994f5dee8a0f6"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YTQ3NTdiY2FhNjJiNjMwNjRjNTVlNzkzMGI5Y2FhZTg",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "da76ca59f6a57ee3102f8f9bd9cee742973efa8a",
"md5" : "caafe376afb7086dcbee79f780394ca3"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar.sha1",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NDhjN2E2NzlhYTY3OTc2YjUzNTAxMDQ3NmNkNmE5YTY",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "8bcb4c89b77770f8f1ad0fe09c5c9e01b330eb0d",
"md5" : "978b90e9c00ed4b44110073b0ee54be1"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmYwYmNmZjMzOWJlZWYwNjJhZjg5NmY0Y2Y2Y2YzMWE",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "df51c4a85dd6acf8b6cdc9323596766b3d577c28",
"md5" : "53f7013d37871f9bc0445619999c09bf"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom.sha1",
"path" : "org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NDhjN2E2NzlhYTY3OTc2Yjg5NzFkYTVhNjEzNDExOGY",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "bbafa9a1fe00aadabb4e318c8ff98ce9aaa9abdf",
"md5" : "a767a8bb2b65cc02877c2cefd4c97228"
}
} ]
}, {
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6NTgxODAwNWRlMmViMmJkMTA0MjUzNjVmMjI2YmI4MDE",
"repository" : "spring-milestones",
"format" : "maven2",
"group" : "org.slf4j",
"name" : "slf4j-api",
"version" : "1.7.12",
"assets" : [ {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom",
"path" : "org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YTQ3NTdiY2FhNjJiNjMwNjg2NDcyMWE0YjAwYmQzOGU",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "1163b15d6680795fcc64a14e0c8426a3cc0825a3",
"md5" : "6eb81f637e9d81b6a71d0757a9f27c20"
}
}, {
"downloadUrl" : "http://nexus.example.com/repository/spring-milestones/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom.sha1",
"path" : "org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom.sha1",
"id" : "c3ByaW5nLW1pbGVzdG9uZXM6YmU3NjU5YzQ4Yjg2OGFkNDU5NjIxMGNmODQ3MWM4NjU",
"repository" : "spring-milestones",
"format" : "maven2",
"checksum" : {
"sha1" : "d074e9ad1a69f8b5937da7f7dd9434d5ad57ef4f",
"md5" : "dc0ed4d57b058941f42ec61d0be415a9"
}
} ]
} ],
"continuationToken" : null
}
, which seems to have all the data we need. Disregard the weird repository and slf4j-api version - it seems to be some issue with proxy and/or group repositories.
The full API is documented here. There is also a swagger-ui available to poke around in this API (http://nexus.example.com/swagger-ui/).
Hi @nigredo-tori, thanks for pointing this out! Just to clarify, have the API endpoints themselves changed, or just the returned responses? Do you know of any public Nexus 3 repositories that we could use for testing?
Regarding public Nexus 3 repositories - I haven't found one yet, probably because switching to Nexus 3 breaks a lot of stuff. It's telling that even https://oss.sonatype.org/ hasn't been upgraded. :smile: The only thing I can think of is to spin up a docker container, publish a couple of artifacts there, and test with that.
Actually, I've just found one: https://nexus.pentaho.org/. Here's an example search.
Thanks for the extra info and for finding that Nexus 3 repository! Given that the API endpoints have changed, we probably can't get away with a unique request to cover both Nexus 2 and 3 repository types.
We could add a new query parameter to our existing badge URLs which would allow users to say upfront whether we're querying Nexus 2 or 3. However, the issue is that their badges will break when a Nexus instance is migrated from version 2 to 3. In particular repositories like https://oss.sonatype.org/ are probably quite popular with our users, so we should plan ahead for when it's migrated.
We could perform several API requests, and if a Nexus 2 API request fails, fall back to perform a Nexus 3 API request. When Nexus 3 becomes more widespread, we swap them around and do the v3 API request first. The downside would be added complexity and a small performance hit for users that are in the "fall back" case, however, the big plus with this approach is that all badges will still work without any user intervention.
We could do a mixture of the two approaches described above: add an optional query parameter to allow users to specify whether it's a Nexus 2 or 3, and if the parameter is not specified try querying both endpoint types.
What do you think?
@PyvesB, the two-request approach makes sense, as does the optional parameter one. Note, however, that updating private Nexus instances to Nexus 3 can still break badges. It's pretty common to install Nexus 2 to the /nexus/ path (http://example.com/nexus/ rather than http://example.com) - the official Docker image does this. In contrast, the official Nexus 3 image uses the root path. So unless we add some URL path prefix stripping logic (which I don't think we should do), the badges will still break for people that use http://example.com/nexus/. But for large public Nexus instances (http://oss.sonatype.org) this shouldn't be an issue.
which I don't think we should do
I agree. In those specific cases, the Nexus server base URL changes, so users should be expected to change their badges to reflect this.
By the way, as you seem quite well-versed in all things Nexus, would you like to give this a go and submit a pull request? 馃槂
you seem quite well-versed in all things Nexus
Thank you, but I'm not. I've helped someone update an instance last week, and that's it. I'm just poking around/googling as I go, doing my due diligence to make sure this issue will be reasonably easy to solve.
would you like to give this a go and submit a pull request?
I'd prefer not to. I know next to nothing about this project and about JS in general, so I'd like this to be handled by someone with hands-on experience with these. Nexus insight shouldn't be as important here, since both the new and the old API seem to be well-documented.
Fair - if no one takes a took at it in the meantime, I'll probably pick this up in early 2020. I'll assign you as reviewer so you can take a look at the changes once they're done. 馃槈