类名:WebMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.google.adk.maven.WebMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="web", requiresDependencyResolution=RUNTIME) @Execute(phase=COMPILE) public class WebMojo extends org.apache.maven.plugin.AbstractMojo
这是一个 Maven 插件目标(plugin goal),用于使用用户提供的代理(agents)来启动 Google ADK Web 服务器。

这个 Mojo 为开发者提供了一种便捷的方式,让他们可以通过 ADK Web UI 来测试和与他们的代理程序进行交互。该插件会动态加载用户自定义的代理程序,并通过浏览器界面将这些代理程序提供给开发者使用。

基本用法

mvn google-adk:web -Dagents=com.example.MyAgentLoader

配置参数

  • 代理(agents) (必填)- AgentLoader 实现类的完整类路径
  • 端口 (可选,默认值:8000)– 服务器端口
  • 主机 (可选,默认值:localhost)– 服务器主机地址
  • hotReloading (可选,默认值为 true)– 为基于配置的代理启用热重载功能。
  • 注册表(registry) (可选):自定义 `ComponentRegistry` 子类的完整类路径,用于注入定制的工具和代理程序。

AgentLoader 的实现方式

`agents` 参数应该指向一个实现了某个接口(或协议)的类。 AgentLoader它可以引用以下两者中的任意一个:

  • 一个静态字段(static field): com.example.MyProvider.INSTANCE
  • 一个具有默认构造函数的类: com.example.MyProvider

Web界面

启动后,ADK Web UI 即可使用。 http://host:port,或者是在…… http://localhost:port 用于循环测试(loopback)或使用通配符(wildcard)的主机。

Author:
Google ADK Team
  • 字段摘要

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • 构造函数概述

    Constructors
    Constructor
    Description
     
  • 方法概述

    Modifier and Type
    Method
    Description
    void
     

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造函数详细信息

    • WebMojo

      public WebMojo()
  • 方法详细信息(Method Details)

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException