buildscript {
    dependencies {
        classpath("com.bmuschko:gradle-tomcat-plugin:2.7.0")
    }
}
apply plugin: "com.bmuschko.tomcat"
dependencies {
    def tomcatVersion = '10.0.14'
    tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
            "org.apache.tomcat.embed:tomcat-embed-logging-juli:9.0.0.M6",
            "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
}
tomcat {
    httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
    ajpProtocol  = 'org.apache.coyote.ajp.AjpNio2Protocol'
}
 
运行gradle tomcatRun命令会发现以下报错:
 Caused by: java.lang.IllegalArgumentException: The AJP Connector is configured with secretRequired=“true” but the secret attribute is either null or “”. This combination is not valid
但gradle-tomcat-plugin插件并没有提供相关Ajp Connector的配置项。
最后在overflow找到了解决方法
 https://stackoverflow.com/questions/61340695/gradle-plugin-for-tomcat-9-0-34
将ajpProtocol = ‘org.apache.coyote.ajp.AjpNio2Protocol’
 替换成
 ajpProtocol = ‘org.apache.coyote.http11.Http11Nio2Protocol’
 绕过Ajp的连接器协议










