【问题标题】:##[error]No agent found in pool Agent which satisfies the specified demands: maven, Agent.Version -gtVersion 2.163.1##[错误]在池中找不到满足指定要求的代理:maven,Agent.Version -gtVersion 2.163.1
【发布时间】: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


【解决方案1】:

功能中没有maven,可以手动添加:

【讨论】:

  • 我在 Windows 10 上遇到了类似的错误。“##[错误]在池中找不到满足以下要求的代理:visualstudio。所有要求:msbuild、visualstudio、Agent.Version -gtVersion 2.115。 0”,添加“名称:visualstudio 值:true”后,开始构建。但构建失败并显示更有用的警告“##[warning]Visual Studio 未找到。尝试安装受支持的 Visual Studio 版本。有关受支持版本的列表,请参阅任务定义。”
最近更新 更多