使用Maven(apigee-edge-maven-plugin:1.0.0)部署Apigee API包失败求助
Apigee Maven插件部署超时问题排查
使用apigee-edge-maven-plugin:1.0.0部署API到Apigee时,target目录已生成正确的构建压缩包,但部署失败,报错提示Bundle未在预期时间内激活。
执行的部署命令
mvn install -P${envname} -Dapigee_URL=${apigeeURL} -Dapigee_USERNAME=${ApigeeUsername} -Dapigee_PASSWORD=${ApigeePassword} -Dapigee_ORG=${APIGEE_ORG} -Dapigee_OPTIONS=override -Dproject=${PROJECT} -Dapigee_envs=${ENV} -Dapigee.config.options=update
核心报错信息
Request prepared for the server ************************** POST https://localhost:4040/v1/organizations/test-org/environments/test/apis/test_api/revisions/1/deployments accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] content-type: application/x-www-form-urlencoded; charset=UTF-8 [Request body] override=true&delay=5 [INFO] Waiting to assert bundle activation..... [ERROR] Deployment failed to activate [ERROR] Deployment failed: Bundle did not activate within expected time. Please check deployment status manually before trying again [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 18.402 s [INFO] Finished at: 2023-07-05T01:12:15+03:00 [INFO] Final Memory: 13M/297M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.0:deploy (deploy-bundle-step) on project test_api: : MojoExecutionException: org.apache.maven.plugin.MojoExecutionException: Deployment failed: Bundle did not activate within expected time. Please check deployment status manually before trying again
详细错误日志
[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.0:deploy (deploy-bundle-step) on project test_api: : MojoExecutionException: org.apache.maven.plugin.MojoExecutionException: Deployment failed: Bundle did not activate within expected time. Please check deployment status manually before trying again -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.0:deploy (deploy-bundle-step) on project test_api: at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.processHelpfulErrorMessage (DeployMojo.java:343) at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute (DeployMojo.java:328) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: java.io.IOException: org.apache.maven.plugin.MojoExecutionException: Deployment failed: Bundle did not activate within expected time. Please check deployment status manually before trying again at io.apigee.buildTools.enterprise4g.rest.RestUtil.activateBundleRevision (RestUtil.java:641) at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.doActivateBundle (DeployMojo.java:227) at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute (DeployMojo.java:273) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Deployment failed: Bundle did not activate within expected time. Please check deployment status manually before trying again at io.apigee.buildTools.enterprise4g.rest.RestUtil.activateBundleRevision (RestUtil.java:613) at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.doActivateBundle (DeployMojo.java:227) at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute (DeployMojo.java:273) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] 相关Maven文档
可能原因
- Apigee环境资源不足:目标环境的网关服务器CPU、内存负载过高,导致Bundle激活耗时超过插件默认超时时间
- Bundle本身存在配置错误:API Bundle包含无效的策略配置、引用不存在的资源(如密钥库、缓存),导致激活过程卡住
- 网络延迟问题:部署机器与Apigee网关之间的网络不稳定,插件无法及时获取部署状态更新
- 插件默认超时时间过短:
apigee-edge-maven-plugin的默认激活等待时长不足以完成复杂Bundle的部署 - 现有部署冲突:目标环境中已有同API的其他版本处于部署中状态,导致新部署无法正常激活
解决办法
- 检查Apigee环境状态:登录Apigee控制台,查看目标环境的网关节点负载情况,确认是否有资源瓶颈;同时查看API的部署状态,确认Bundle是否真的未激活还是只是插件未检测到
- 验证Bundle配置:手动检查生成的压缩包内容,确保所有策略、资源引用有效;可以尝试在Apigee控制台手动上传部署该Bundle,排查是否存在配置错误
- 调整插件超时参数:在Maven命令中添加
-Dapigee.deploy.timeout=300(单位:秒),延长插件等待激活的超时时间 - 排查网络问题:测试部署机器到Apigee网关的网络连通性,确保没有防火墙或代理导致的延迟
- 清理冲突部署:如果有同API的其他版本正在部署或处于异常状态,先取消或删除这些部署,再重新执行Maven部署
- 升级插件版本:
apigee-edge-maven-plugin:1.0.0版本较旧,尝试升级到最新稳定版,修复已知的部署超时相关问题
内容的提问来源于stack exchange,提问作者Jordan
相关产品推荐
相关产品推荐

