You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/01/19 17:54:45 UTC

(tooling-trusted-releases) branch maven_check_artifacts created (now 6bfe896)

This is an automated email from the ASF dual-hosted git repository.

arm pushed a change to branch maven_check_artifacts
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


      at 6bfe896  Make Maven check use the web URLs instead of the search.maven api

This branch includes the following new commits:

     new 6bfe896  Make Maven check use the web URLs instead of the search.maven api

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org


(tooling-trusted-releases) 01/01: Make Maven check use the web URLs instead of the search.maven api

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

arm pushed a commit to branch maven_check_artifacts
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git

commit 6bfe8968dc8878edcddfefea778185753178f13d
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Mon Jan 19 17:54:33 2026 +0000

    Make Maven check use the web URLs instead of the search.maven api
---
 atr/models/sql.py                    |  3 +-
 atr/storage/writers/distributions.py | 63 ++++++++++++++++++++++++++++--------
 2 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/atr/models/sql.py b/atr/models/sql.py
index 444c134..bc6e4bc 100644
--- a/atr/models/sql.py
+++ b/atr/models/sql.py
@@ -121,7 +121,8 @@ class DistributionPlatform(enum.Enum):
     MAVEN = DistributionPlatformValue(
         name="Maven Central",
         gh_slug="maven",
-        template_url="https://search.maven.org/solrsearch/select?q=g:{owner_namespace}+AND+a:{package}+AND+v:{version}&core=gav&rows=20&wt=json",
+        template_url="https://central.sonatype.com/artifact/{owner_namespace}/{package}/{version}",
+        # template_url="https://search.maven.org/solrsearch/select?q=g:{owner_namespace}+AND+a:{package}+AND+v:{version}&core=gav&rows=20&wt=json",
         # Java ASF projects use staging URLs along the lines of
         template_staging_url="https://repository.apache.org:4443/repository/maven-staging/{owner_namespace}/{package}/maven-metadata.xml",
         # https://repository.apache.org/content/repositories/orgapachePROJECT-NNNN/
diff --git a/atr/storage/writers/distributions.py b/atr/storage/writers/distributions.py
index 4569b1c..69a79cb 100644
--- a/atr/storage/writers/distributions.py
+++ b/atr/storage/writers/distributions.py
@@ -197,21 +197,24 @@ class CommitteeMember(CommitteeParticipant):
         dd: distribution.Data,
     ) -> tuple[sql.Distribution, bool, distribution.Metadata]:
         template_url = await self.__template_url(dd, staging)
-
-        if dd.platform == sql.DistributionPlatform.MAVEN and staging:
-            owner = (dd.owner_namespace or "").replace(".", "/")
-            api_url = template_url.format(
-                owner_namespace=owner,
-                package=dd.package,
-                version=dd.version,
-            )
-            api_oc = await self.__json_from_maven_xml(api_url, dd.version)
+        api_url = template_url.format(
+            owner_namespace=dd.owner_namespace,
+            package=dd.package,
+            version=dd.version,
+        )
+        if dd.platform == sql.DistributionPlatform.MAVEN:
+            if staging:
+                # We do this here because the RAO URL breaks the namespace up into a / delimited URL
+                owner = (dd.owner_namespace or "").replace(".", "/")
+                api_url = template_url.format(
+                    owner_namespace=owner,
+                    package=dd.package,
+                    version=dd.version,
+                )
+                api_oc = await self.__json_from_maven_xml(api_url, dd.version)
+            else:
+                api_oc = await self.__json_from_maven_central(api_url, dd.owner_namespace or "", dd.package, dd.version)
         else:
-            api_url = template_url.format(
-                owner_namespace=dd.owner_namespace,
-                package=dd.package,
-                version=dd.version,
-            )
             api_oc = await self.__json_from_distribution_platform(api_url, dd.platform, dd.version)
         match api_oc:
             case outcome.Result(result):
@@ -347,6 +350,38 @@ class CommitteeMember(CommitteeParticipant):
                     return outcome.Error(e)
         return outcome.Result(result)
 
+    async def __json_from_maven_central(
+        self, api_url: str, group_id: str, artifact_id: str, version: str
+    ) -> outcome.Outcome[basic.JSON]:
+        import datetime
+
+        try:
+            async with aiohttp.ClientSession() as session:
+                async with session.get(api_url) as response:
+                    response.raise_for_status()
+
+            # Use current time as timestamp since we're just validating the package exists
+            timestamp_ms = int(datetime.datetime.now(datetime.UTC).timestamp() * 1000)
+
+            # Convert to dict matching MavenResponse structure
+            result_dict = {
+                "response": {
+                    "start": 0,
+                    "docs": [
+                        {
+                            "g": group_id,
+                            "a": artifact_id,
+                            "v": version,
+                            "timestamp": timestamp_ms,
+                        }
+                    ],
+                }
+            }
+            result = basic.as_json(result_dict)
+            return outcome.Result(result)
+        except aiohttp.ClientError as e:
+            return outcome.Error(e)
+
     async def __json_from_maven_xml(self, api_url: str, version: str) -> outcome.Outcome[basic.JSON]:
         import datetime
         import xml.etree.ElementTree as ET


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org