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

Azure Pipelines执行Maven发布时因提交者邮箱为空被拒

解决Azure Pipeline中Maven Release提交邮箱为空导致的VS403702错误

问题根源是Azure DevOps的{{your project name}} Build Service ({your organization})账号默认未配置邮箱,而Maven Release插件执行release:prepare时会自动创建版本提交,使用当前Git环境的用户信息(即该Build Service账号),空邮箱触发了组织的提交邮箱验证策略,导致推送被拒绝。

以下是三种可行解决方案:

方案1:在Pipeline中直接配置Git用户信息

在执行Maven Release命令前,添加Git全局配置命令,强制指定合法的用户名和邮箱:

# 设置Git全局用户信息,替换为符合组织策略的邮箱
git config --global user.name "{{your project name}} Build Service ({your organization})"
git config --global user.email "build-service@your-organization.com"

如果需要仅针对当前仓库生效,将--global替换为--local即可。

方案2:通过Maven参数指定提交者信息

修改项目的pom.xml,为Maven Release插件添加提交者信息配置:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-release-plugin</artifactId>
      <version>3.0.1</version> <!-- 使用你当前的插件版本 -->
      <configuration>
        <username>${release.user.name}</username>
        <email>${release.user.email}</email>
        <!-- 保留原有其他配置 -->
      </configuration>
    </plugin>
  </plugins>
</build>

然后在Pipeline的Maven命令中传递参数:

mvn release:prepare release:perform -Drelease.user.name="{{your project name}} Build Service ({your organization})" -Drelease.user.email="build-service@your-organization.com"

方案3:配置Build Service账号的默认邮箱

需要组织管理员权限,在Azure DevOps中:

  • 进入Organization Settings → Permissions → Service Accounts
  • 找到{{your project name}} Build Service ({your organization})账号,点击编辑
  • 设置一个符合组织邮箱策略的邮箱地址(比如your-org@dev.azure.com格式的官方邮箱)

验证步骤

可以在Pipeline中添加git config --list命令,确认用户信息已正确配置后,再执行Maven Release命令,避免再次触发错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 01:11:04