You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TeamCity集成Maven Cucumber测试时的参数配置问题

Fixing Maven Parameter Configuration Issue for Cucumber in TeamCity

Hey there, the problem you're facing is almost certainly caused by the extra outer quotes around -Dcucumber.options in your TeamCity build step parameters. Let me break this down and walk you through the fix:

Why the quotes break things

On your local terminal, you need those quotes around "-Dcucumber.options=--tags @test" to tell the shell to pass the entire --tags @test string as a single, unified value to Cucumber. But TeamCity’s parameter input box handles parameter separation automatically—adding those outer quotes makes TeamCity treat the quotes themselves as part of the parameter value, which Cucumber can’t parse correctly.

Correct TeamCity Configuration

Update your 附加Maven命令行参数 to this, removing the outer quotes around the Cucumber options:

-Pdev -Dserver=remote -Dbrowser=ie -Dcucumber.options=--tags @test

If you ever need to pass more complex Cucumber options (like multiple tags or glue paths with spaces), you only need quotes around the value part inside the -D parameter (not the entire -Dcucumber.options=... string). For example:

-Pdev -Dserver=remote -Dbrowser=ie -Dcucumber.options="--tags @test --glue com.example.steps"

Quick Verification Tip

After updating the configuration, run a test build and check the TeamCity build logs. Look for the actual Maven command being executed—it should exactly match the working command you use locally, with no extra stray quotes.

Bonus Troubleshooting Steps

If you still hit issues:

  • Double-check that the TeamCity agent uses the same Maven version as your local machine (version mismatches can cause subtle parameter parsing differences)
  • Verify there are no conflicting environment variables set on the agent that might override your cucumber.options or other parameters

内容的提问来源于stack exchange,提问作者arena

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:30:22