Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven property resolves to a stale version #802

Open
bjaglin opened this issue Jun 8, 2023 · 4 comments
Open

Maven property resolves to a stale version #802

bjaglin opened this issue Jun 8, 2023 · 4 comments

Comments

@bjaglin
Copy link

bjaglin commented Jun 8, 2023

steps

Issue detected on scalacenter/scalafix.g8#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:

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>
@eed3si9n
Copy link
Member

eed3si9n commented Jun 8, 2023

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

@bjaglin
Copy link
Author

bjaglin commented Jun 8, 2023

@bjaglin
Copy link
Author

bjaglin commented Oct 15, 2023

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": []
  }
}

@bjaglin bjaglin closed this as completed Oct 15, 2023
@bjaglin bjaglin reopened this Sep 8, 2024
@bjaglin
Copy link
Author

bjaglin commented Sep 8, 2024

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 😬

$ 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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants