giter8
giter8 copied to clipboard
Maven property resolves to a stale version
steps
Issue detected on https://github.com/scalacenter/scalafix.g8/pull/100
- sbt 1.9.0
- sbt-giter8 0.16.2
problem
➜ amm
Loading...
Welcome to the Ammonite Repl 2.5.2 (Scala 2.13.8 Java 11.0.19)
@ import $ivy.`org.foundweekends.giter8::giter8:0.16.2`
import $ivy.$
@ giter8.Maven.lookup((("scalafix_version", "maven(ch.epfl.scala, sbt-scalafix)")) :: Nil)
res1: Either[String, giter8.G8.OrderedProperties] = Right(value = List(("scalafix_version", "0.10.4")))
expectation
-res1: Either[String, giter8.G8.OrderedProperties] = Right(value = List(("scalafix_version", "0.10.4")))
+res1: Either[String, giter8.G8.OrderedProperties] = Right(value = List(("scalafix_version", "0.11.0")))
since sbt-scalafix 0.11.0 is on Maven central:
- https://repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/0.11.0/sbt-scalafix-0.11.0.pom
- https://repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/maven-metadata.xml
notes
The problem seems to come from the REST API used to lookup the latest artifact, as https://search.maven.org/solrsearch/select?q=g:%22ch.epfl.scala%22+AND+a:%22sbt-scalafix%22&rows=10&wt=xml returns stale results as of June 8th (5 days after the missing artifact was published).
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">3</int>
<lst name="params">
<str name="q">g:"ch.epfl.scala" AND a:"sbt-scalafix"</str>
<str name="core"/>
<str name="indent">off</str>
<str name="spellcheck">true</str>
<str name="fl">id,g,a,latestVersion,p,ec,repositoryId,text,timestamp,versionCount</str>
<str name="start"/>
<str name="spellcheck.count">5</str>
<str name="sort">score desc,timestamp desc,g asc,a asc</str>
<str name="rows">10</str>
<str name="wt">xml</str>
<str name="version">2.2</str>
</lst>
</lst>
<result name="response" numFound="2" start="0">
<doc>
<str name="a">sbt-scalafix</str>
<arr name="ec">
<str>.pom</str>
<str>.jar</str>
</arr>
<str name="g">ch.epfl.scala</str>
<str name="id">ch.epfl.scala:sbt-scalafix724599971</str>
<str name="latestVersion">0.10.4</str>
<str name="p">jar</str>
<str name="repositoryId">central</str>
<arr name="text">
<str>ch.epfl.scala</str>
<str>sbt-scalafix</str>
<str>.pom</str>
<str>.jar</str>
</arr>
<long name="timestamp">1665436577000</long>
<int name="versionCount">72</int>
</doc>
<doc>
<str name="a">sbt-scalafix</str>
<arr name="ec">
<str>.jar</str>
<str>.pom</str>
</arr>
<str name="g">ch.epfl.scala</str>
<str name="id">ch.epfl.scala:sbt-scalafix-1555225206</str>
<str name="latestVersion">0.9.29</str>
<str name="p">jar</str>
<str name="repositoryId">central</str>
<arr name="text">
<str>ch.epfl.scala</str>
<str>sbt-scalafix</str>
<str>.jar</str>
<str>.pom</str>
</arr>
<long name="timestamp">1622413366000</long>
<int name="versionCount">88</int>
</doc>
</result>
<lst name="spellcheck">
<lst name="suggestions"/></lst>
</response>
It sounds like Giter8 is working as intended but Maven Search is broken? Could you report this to Sonatype as well please?
https://issues.sonatype.org/login.jsp
https://issues.sonatype.org/browse/OSSRH-92323
The Maven search is no longer stale (for some unknown reason) as the latest artifact (0.11.1) now appears
$ curl -s 'https://search.maven.org/solrsearch/select?q=g:%22ch.epfl.scala%22+AND+a:%22sbt-scalafix%22&rows=10' | jq ''.
{
"responseHeader": {
"status": 0,
"QTime": 0,
"params": {
"q": "g:\"ch.epfl.scala\" AND a:\"sbt-scalafix\"",
"core": "",
"indent": "off",
"spellcheck": "true",
"fl": "id,g,a,latestVersion,p,ec,repositoryId,text,timestamp,versionCount",
"start": "",
"spellcheck.count": "5",
"sort": "score desc,timestamp desc,g asc,a asc",
"rows": "10",
"wt": "json",
"version": "2.2"
}
},
"response": {
"numFound": 2,
"start": 0,
"docs": [
{
"id": "ch.epfl.scala:sbt-scalafix724599971",
"g": "ch.epfl.scala",
"a": "sbt-scalafix",
"latestVersion": "0.11.1",
"repositoryId": "central",
"p": "jar",
"timestamp": 1694397604266,
"versionCount": 73,
"text": [
"ch.epfl.scala",
"sbt-scalafix",
"-sources.jar",
".pom",
"-javadoc.jar",
".jar"
],
"ec": [
"-sources.jar",
".pom",
"-javadoc.jar",
".jar"
]
},
{
"id": "ch.epfl.scala:sbt-scalafix-1555225206",
"g": "ch.epfl.scala",
"a": "sbt-scalafix",
"latestVersion": "0.9.29",
"repositoryId": "central",
"p": "jar",
"timestamp": 1622413366000,
"versionCount": 88,
"text": [
"ch.epfl.scala",
"sbt-scalafix",
".jar",
".pom"
],
"ec": [
".jar",
".pom"
]
}
]
},
"spellcheck": {
"suggestions": []
}
}
Reopening this, as the problem is back... And the issue I opened on Sonatype (which didn't get traction anyway) is gone since they moved from Jira to Zendesk :grimacing:
$ amm
@ import $ivy.`org.foundweekends.giter8::giter8:0.16.2`
import $ivy.$
@
giter8.Maven.lookup((("scalafix_version", "maven(ch.epfl.scala, sbt-scalafix)")) :: Nil)
res1: Either[String, giter8.G8.OrderedProperties] = Right(
value = List(("scalafix_version", "0.11.1"))
)
$ curl https://repo1.maven.org/maven2/ch/epfl/scala/sbt-scalafix_2.12_1.0/maven-metadata.xml
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>ch.epfl.scala</groupId>
<artifactId>sbt-scalafix_2.12_1.0</artifactId>
<versioning>
<latest>0.12.1</latest>
<release>0.12.1</release>
<versions>
<version>0.11.0</version>
<version>0.11.1</version>
<version>0.12.0</version>
<version>0.12.1</version>
</versions>
<lastUpdated>20240501200209</lastUpdated>
</versioning>
</metadata>