【发布时间】:2021-01-05 14:25:36
【问题描述】:
我有一个使用 maven-release-plugin 的父 pom,其中包含需要推送到 Azure 工件的工件。我能够让它在我的本地工作,现在正在尝试使用 azure 管道自动化它,但我收到了 mvn release:perform 的以下错误。
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:perform (default-cli) on project my-parent-repo: Unable to checkout from SCM
[ERROR] Provider message:
[ERROR] The git-clone command failed.
[ERROR] Command output:
[ERROR] Cloning into 'checkout'...
[ERROR] fatal: could not read Password for 'https:********@dev.azure.com': terminal prompts disabled
[ERROR] -> [Help 1]
我的 pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<scm>
<developerConnection>scm:git:https://$(PAT)@dev.azure.com/my-org/my-prjt/_git/my-parent-repo/</developerConnection>
<tag>HEAD</tag>
</scm>
<groupId>dispute</groupId>
<artifactId>my-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Microservice DI parent</name>
<description>DI microservice parent </description>
<distributionManagement>
<!-- Publish the versioned releases here -->
<repository>
<id>repo</id>
<name>Artifact repo</name>
<url>https://xxx.pkgs.visualstudio.com/2abc/_packaging/my-maven-artifacts/maven/v1</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>my-maven-artifacts</id>
<url>
https://xxx.pkgs.visualstudio.com/2abc/_packaging/my-maven-artifacts/maven/v1
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Pod4-artifacts</id>
<url>
https://xxx.pkgs.visualstudio.com/2abc/_packaging/my-maven-artifacts/maven/v1
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<!-- Build properties -->
<maven.version>3.3.9</maven.version>
<java.version>11</java.version>
</properties>
</project>
已尝试修复:
我在代理作业上启用了Allow scripts to access the OAuth token。我还为 Project Collection Service Accounts 和 Project Collection Build Service 提供了在 Repositories 下创建标签、分支和贡献的权限。
此外,还有一个 ci-settings.xml,其中包含 repo id 的用户名和密码,它们在 Azure 管道中的 Maven 任务中作为参数提供。
-e -B -s $(System.DefaultWorkingDirectory)/ci-settings.xml
如果有什么遗漏,请告诉我。请注意,它在我的本地运行良好。
【问题讨论】:
标签: azure-devops azure-pipelines maven-release-plugin