在Azure DevOps中使用maven部署部署工件时未找到传输协议



当我试图在Azure DevOPS中部署JAR工件到工件提要时,面临以下问题。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project: No transfer protocol found. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

以下是我的YAML代码:

- task: Maven@3
displayName: 'Maven Deploy'
inputs:
mavenPomFile: 'pom.xml'
goals: 'deploy:deploy-file'
options: '-DgroupId="com.mycompany" -DartifactId="s-demo-cicd" -Dversion="1.0.1" - 
Dpackaging=jar -Dfile="demo-1.0.1-mule-application.jar" -DgeneratePom="true" - 
DrepositoryId="$AZURE_FEED_ID" -Durl="$AZURE_FEED_URL"'

我在POM.xml文件中添加了所需的依赖项。

<distributionManagement>
<repository>
<id>demo-mule</id>
<url>https://pkgs.dev.azure.com/demo-mule/_packaging/demo-mule/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>

请帮助我了解我需要在哪里进行更改或更新。

要将变量传递到Maven任务的参数中,请确保使用正确的表示法。它有时会有点令人困惑。

在这种情况下,使用$(...)而不是$...。所以你的任务是这样的:

- task: Maven@3
displayName: 'Maven Deploy'
inputs:
mavenPomFile: 'pom.xml'
goals: 'deploy:deploy-file'
options: '-DgroupId="com.mycompany" -DartifactId="s-demo-cicd" -Dversion="1.0.1" - 
Dpackaging=jar -Dfile="demo-1.0.1-mule-application.jar" -DgeneratePom="true" - 
DrepositoryId="$(AZURE_FEED_ID)" -Durl="$(AZURE_FEED_URL)"'