【发布时间】:2026-01-26 19:45:01
【问题描述】:
我正在尝试在 Azure DevOps 服务上构建和发布管道,就像我在 Azure 中托管的 linuxVM 上使用自托管 Linux 代理运行一样。
之前在 Microsoft 托管代理上运行相同的管道没有错误。
现在我收到##[error]No agent found in pool ProjectAgent which satisfies the specified demands: maven, Agent.Version -gtVersion 2.163.1
我已经在自托管 Linux 代理上安装了 Java a 和 maven
:/home/-agent/_work/2/s/kubernetes # echo $JAVA_HOME
/usr/lib64/jvm/java
:/home/l-agent/_work/2/s/kubernetes # echo $M2_HOME
/opt/apache-maven-3.6.3
:/home/heisoul-agent/_work/2/s/kubernetes #
即使在代理能力中也是如此
管道 Yaml
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
resources:
- repo: self
trigger:
batch: true
branches:
include:
- main
pool:
name: 'ProjectAgent'
variables:
tags: '$(Build.BuildNumber)'
- task: MavenAuthenticate@0
displayName: 'Maven Authenticate'
inputs:
artifactsFeeds: myapp-snapshots,myapp-releases
- task: Maven@3
displayName: 'Code Scan'
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/app-solution/core/build/maven/pom.xml'
goals: package
mavenAuthenticateFeed: true
publishJUnitResults: true
sonarQubeRunAnalysis: true
sqMavenPluginVersionChoice: 'latest'
管道失败
【问题讨论】:
-
有谁知道 azure devops 代理如何收集功能,因为它清除了尽管我们安装了 maven 或 ant 或任何其他工具,但我们重新启动了代理服务,但它不会在功能列表中显示为默认值,并且那么我们必须手动给它。
标签: maven azure-devops azure-pipelines maven-3 azure-devops-pipelines