maven-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When to use this skill

何时使用该技能

ALWAYS use this skill when the user mentions:
  • Searching for Maven dependencies or components
  • Finding Maven coordinates (groupId, artifactId, version)
  • Checking component versions or version history
  • Retrieving Maven artifacts (JAR, POM, sources, Javadoc)
  • Verifying Maven dependency coordinates
  • Analyzing dependency trees or transitive dependencies
  • Working with Maven Central Repository
  • Any request related to Maven components, libraries, or dependencies
Trigger phrases include:
  • "查找 Maven 依赖" (find Maven dependency), "搜索 Maven 组件" (search Maven component)
  • "Maven 坐标" (Maven coordinates), "groupId" (groupId), "artifactId" (artifactId)
  • "Maven 版本" (Maven version), "最新版本" (latest version), "版本历史" (version history)
  • "Maven Central" (Maven Central), "Maven 仓库" (Maven repository)
  • "下载 Maven 依赖" (download Maven dependency), "获取 POM 文件" (get POM file)
  • "依赖树" (dependency tree), "传递依赖" (transitive dependencies)
  • Any mention of "Maven", "dependency", "artifact", "repository", "coordinates"
当用户提及以下内容时,务必使用本技能:
  • 搜索Maven依赖或组件
  • 查找Maven坐标(groupId、artifactId、版本)
  • 检查组件版本或版本历史
  • 检索Maven构件(JAR、POM、源码、Javadoc)
  • 验证Maven依赖坐标
  • 分析依赖树或传递依赖
  • 操作Maven Central Repository
  • 任何与Maven组件、库或依赖相关的请求
触发短语包括:
  • "查找 Maven 依赖"、"搜索 Maven 组件"
  • "Maven 坐标"、"groupId"、"artifactId"
  • "Maven 版本"、"最新版本"、"版本历史"
  • "Maven Central"、"Maven 仓库"
  • "下载 Maven 依赖"、"获取 POM 文件"
  • "依赖树"、"传递依赖"
  • 任何提及"Maven"、"dependency"、"artifact"、"repository"、"coordinates"的表述

How to use this skill

如何使用该技能

CRITICAL: This skill should be triggered when the user needs to search, retrieve, or work with Maven components from Maven Central Repository.
Trigger this skill when you see:
  • User says "查找 Maven 依赖" (find Maven dependency), "搜索 Maven 组件" (search Maven component)
  • User needs Maven coordinates (groupId, artifactId, version)
  • User wants to check component versions or retrieve artifacts
  • User mentions Maven Central Repository or Maven dependencies
  • User needs to analyze dependencies or verify coordinates
To search for Maven components:
  1. Identify the search type from the user's request:
    • Search by name → Use Maven Central Search API
    • Get specific version → Use direct repository URL
    • Check latest version → Query maven-metadata.xml
    • Analyze dependencies → Parse POM file
    • Download artifact → Use direct download URL
  2. Load the appropriate example file from the
    examples/
    directory:
    • examples/search-by-name.md
      - Search components by name or keywords
    • examples/search-by-coordinates.md
      - Search by groupId and artifactId
    • examples/get-version-info.md
      - Get version information and history
    • examples/download-artifact.md
      - Download JAR, POM, sources, or Javadoc
    • examples/analyze-dependencies.md
      - Analyze dependency tree
    • examples/verify-coordinates.md
      - Verify Maven coordinates validity
  3. Follow the specific instructions in that example file for API endpoints, parameters, and best practices
  4. Use Maven Central Repository API:
    • Query parameter:
      q
      - Search query (e.g.,
      g:com.google.guava AND a:guava
      )
    • Rows parameter:
      rows
      - Number of results (default: 20, max: 200)
    • Start parameter:
      start
      - Pagination offset
    • Core parameter:
      core
      - Search core (default:
      gav
      )
    Direct Repository Access (https://repo1.maven.org/maven2/):
    • Path format:
      {groupId}/{artifactId}/{version}/{artifactId}-{version}.{extension}
    • GroupId path: Replace dots with slashes (e.g.,
      com.google.guava
      com/google/guava
      )
    • Metadata:
      maven-metadata.xml
      for version information
    • POM file:
      {artifactId}-{version}.pom
    • JAR file:
      {artifactId}-{version}.jar
    • Sources:
      {artifactId}-{version}-sources.jar
    • Javadoc:
      {artifactId}-{version}-javadoc.jar
  5. Construct the appropriate URL:
    Search Example:
    https://search.maven.org/solrsearch/select?q=g:com.google.guava+AND+a:guava&rows=20&wt=json
    Direct Access Example:
    https://repo1.maven.org/maven2/com/google/guava/guava/maven-metadata.xml
    https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.pom
    https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.jar
  6. Parse and format the results:
    • Extract relevant information (groupId, artifactId, version, description)
    • Format coordinates in standard Maven format:
      groupId:artifactId:version
    • Present results in a clear, structured format
    • Include download links and metadata when relevant
  7. Validate coordinates:
    • Verify groupId format (should be reverse domain notation)
    • Check artifactId format (should be lowercase, hyphen-separated)
    • Validate version format (semantic versioning preferred)
    • Confirm artifact exists before providing download links
Output Format Requirements:
  • Always provide Maven coordinates in standard format:
    groupId:artifactId:version
  • Include direct download URLs when relevant
  • Format search results in a clear, structured table or list
  • Provide metadata information (description, repository, last updated) when available
  • Include version information and release dates when querying versions
重要提示:当用户需要从Maven Central Repository搜索、检索或操作Maven组件时,应触发本技能。
当出现以下情况时触发本技能:
  • 用户说"查找 Maven 依赖"、"搜索 Maven 组件"
  • 用户需要Maven坐标(groupId、artifactId、版本)
  • 用户想要检查组件版本或检索构件
  • 用户提及Maven Central Repository或Maven依赖
  • 用户需要分析依赖或验证坐标
搜索Maven组件的步骤:
  1. 根据用户请求确定搜索类型
    • 按名称搜索 → 使用Maven Central Search API
    • 获取特定版本 → 使用直接仓库URL
    • 检查最新版本 → 查询maven-metadata.xml
    • 分析依赖 → 解析POM文件
    • 下载构件 → 使用直接下载URL
  2. examples/
    目录加载对应的示例文件
    • examples/search-by-name.md
      - 按名称或关键词搜索组件
    • examples/search-by-coordinates.md
      - 按groupId和artifactId搜索
    • examples/get-version-info.md
      - 获取版本信息及历史
    • examples/download-artifact.md
      - 下载JAR、POM、源码或Javadoc
    • examples/analyze-dependencies.md
      - 分析依赖树
    • examples/verify-coordinates.md
      - 验证Maven坐标的有效性
  3. 遵循示例文件中的具体说明,包括API端点、参数及最佳实践
  4. 使用Maven Central Repository API
    • 查询参数:
      q
      - 搜索查询语句(例如:
      g:com.google.guava AND a:guava
    • 行数参数:
      rows
      - 结果数量(默认:20,最大值:200)
    • 起始参数:
      start
      - 分页偏移量
    • 核心参数:
      core
      - 搜索核心(默认:
      gav
    • 路径格式:
      {groupId}/{artifactId}/{version}/{artifactId}-{version}.{extension}
    • GroupId路径转换:将点替换为斜杠(例如:
      com.google.guava
      com/google/guava
    • 元数据文件:
      maven-metadata.xml
      用于获取版本信息
    • POM文件:
      {artifactId}-{version}.pom
    • JAR文件:
      {artifactId}-{version}.jar
    • 源码包:
      {artifactId}-{version}-sources.jar
    • Javadoc包:
      {artifactId}-{version}-javadoc.jar
  5. 构造合适的URL
    搜索示例
    https://search.maven.org/solrsearch/select?q=g:com.google.guava+AND+a:guava&rows=20&wt=json
    直接访问示例
    https://repo1.maven.org/maven2/com/google/guava/guava/maven-metadata.xml
    https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.pom
    https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.jar
  6. 解析并格式化结果
    • 提取相关信息(groupId、artifactId、版本、描述)
    • 以标准Maven格式展示坐标:
      groupId:artifactId:version
    • 以清晰、结构化的格式呈现结果
    • 相关时包含下载链接和元数据
  7. 验证坐标
    • 验证groupId格式(应为反向域名格式)
    • 检查artifactId格式(应为小写、连字符分隔)
    • 验证版本格式(推荐使用语义化版本)
    • 提供下载链接前确认构件存在
输出格式要求
  • 始终以标准格式
    groupId:artifactId:version
    提供Maven坐标
  • 相关时包含直接下载URL
  • 以清晰的结构化表格或列表展示搜索结果
  • 可用时提供元数据信息(描述、仓库、最后更新时间)
  • 查询版本时包含版本信息及发布日期

Maven Central Repository Structure

Maven Central Repository结构

Repository Base URL

仓库基础URL

Path Structure

路径结构

{groupId}/{artifactId}/{version}/{artifactId}-{version}.{extension}
Example:
com/google/guava/guava/33.0.0/guava-33.0.0.jar
{groupId}/{artifactId}/{version}/{artifactId}-{version}.{extension}
示例:
com/google/guava/guava/33.0.0/guava-33.0.0.jar

Available Artifacts

可用构件类型

  • POM:
    {artifactId}-{version}.pom
    - Project Object Model file
  • JAR:
    {artifactId}-{version}.jar
    - Compiled Java classes
  • Sources:
    {artifactId}-{version}-sources.jar
    - Source code
  • Javadoc:
    {artifactId}-{version}-javadoc.jar
    - API documentation
  • Metadata:
    maven-metadata.xml
    - Version and release information
  • POM:
    {artifactId}-{version}.pom
    - 项目对象模型文件
  • JAR:
    {artifactId}-{version}.jar
    - 编译后的Java类文件
  • 源码包:
    {artifactId}-{version}-sources.jar
    - 源代码
  • Javadoc包:
    {artifactId}-{version}-javadoc.jar
    - API文档
  • 元数据:
    maven-metadata.xml
    - 版本及发布信息

Search API Parameters

搜索API参数

Query Syntax

查询语法

  • GroupId search:
    g:com.google.guava
  • ArtifactId search:
    a:guava
  • Version search:
    v:33.0.0
  • Combined search:
    g:com.google.guava AND a:guava
  • Text search:
    guava
    (searches in groupId, artifactId, and description)
  • 按groupId搜索:
    g:com.google.guava
  • 按artifactId搜索:
    a:guava
  • 按版本搜索:
    v:33.0.0
  • 组合搜索:
    g:com.google.guava AND a:guava
  • 文本搜索:
    guava
    (在groupId、artifactId和描述中搜索)

Response Format

响应格式

  • JSON:
    wt=json
    (default)
  • XML:
    wt=xml
  • Java properties:
    wt=javabin
  • JSON:
    wt=json
    (默认)
  • XML:
    wt=xml
  • Java属性:
    wt=javabin

Pagination

分页参数

  • rows: Number of results per page (default: 20, max: 200)
  • start: Offset for pagination (default: 0)
  • rows: 每页结果数量(默认:20,最大值:200)
  • start: 分页偏移量(默认:0)

Best Practices

最佳实践

  1. Always verify coordinates: Check that groupId, artifactId, and version exist before use
  2. Use latest stable versions: Prefer RELEASE versions over SNAPSHOT versions
  3. Check version metadata: Query
    maven-metadata.xml
    for latest version information
  4. Validate before download: Verify artifact exists before providing download links
  5. Include checksums: When available, provide SHA-1 and MD5 checksums for verification
  6. Format coordinates correctly: Always use standard Maven format
    groupId:artifactId:version
  7. Provide context: Include description, repository information, and last updated date when available
  1. 始终验证坐标: 使用前确认groupId、artifactId和版本存在
  2. 使用最新稳定版本: 优先选择RELEASE版本而非SNAPSHOT版本
  3. 检查版本元数据: 查询
    maven-metadata.xml
    获取最新版本信息
  4. 下载前验证: 提供下载链接前确认构件存在
  5. 包含校验和: 可用时提供SHA-1和MD5校验和用于验证
  6. 正确格式化坐标: 始终使用标准Maven格式
    groupId:artifactId:version
  7. 提供上下文信息: 可用时包含描述、仓库信息及最后更新日期

Common Tasks

常见任务

Task 1: Search by Name

任务1:按名称搜索

Use the Search API with text query to find components by name or keywords.
Example:
GET https://search.maven.org/solrsearch/select?q=guava&rows=20&wt=json
使用搜索API的文本查询按名称或关键词查找组件。
示例:
GET https://search.maven.org/solrsearch/select?q=guava&rows=20&wt=json

Task 2: Search by Coordinates

任务2:按坐标搜索

Use the Search API with groupId and artifactId to find specific components.
Example:
GET https://search.maven.org/solrsearch/select?q=g:com.google.guava+AND+a:guava&rows=20&wt=json
使用搜索API按groupId和artifactId查找特定组件。
示例:
GET https://search.maven.org/solrsearch/select?q=g:com.google.guava+AND+a:guava&rows=20&wt=json

Task 3: Get Version Information

任务3:获取版本信息

Query
maven-metadata.xml
to get all available versions and latest version.
Example:
GET https://repo1.maven.org/maven2/com/google/guava/guava/maven-metadata.xml
查询
maven-metadata.xml
获取所有可用版本及最新版本。
示例:
GET https://repo1.maven.org/maven2/com/google/guava/guava/maven-metadata.xml

Task 4: Download Artifact

任务4:下载构件

Construct direct download URL for specific artifact.
Example:
GET https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.jar
构造特定构件的直接下载URL。
示例:
GET https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.jar

Task 5: Analyze Dependencies

任务5:分析依赖

Download and parse POM file to extract dependency information.
Example:
GET https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.pom
下载并解析POM文件以提取依赖信息。
示例:
GET https://repo1.maven.org/maven2/com/google/guava/guava/33.0.0/guava-33.0.0.pom

Keywords

关键词

English keywords: maven, maven central, maven repository, maven dependency, maven artifact, maven component, groupId, artifactId, version, coordinates, pom, jar, dependency, repository, search, retrieve, download, metadata, transitive dependencies, dependency tree, maven coordinates, maven search
Chinese keywords (中文关键词): Maven, Maven 中央仓库, Maven 仓库, Maven 依赖, Maven 组件, Maven 坐标, groupId, artifactId, version, 版本, 坐标, POM, JAR, 依赖, 仓库, 搜索, 检索, 下载, 元数据, 传递依赖, 依赖树, 查找依赖, 搜索组件, 获取版本, 下载依赖
英文关键词: maven, maven central, maven repository, maven dependency, maven artifact, maven component, groupId, artifactId, version, coordinates, pom, jar, dependency, repository, search, retrieve, download, metadata, transitive dependencies, dependency tree, maven coordinates, maven search
中文关键词: Maven, Maven 中央仓库, Maven 仓库, Maven 依赖, Maven 组件, Maven 坐标, groupId, artifactId, version, 版本, 坐标, POM, JAR, 依赖, 仓库, 搜索, 检索, 下载, 元数据, 传递依赖, 依赖树, 查找依赖, 搜索组件, 获取版本, 下载依赖

Resources

参考资源