microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: No agent found in pool Azure Pipelines which satisfies the following demand: maven. All demands: Agent.OS -equals Linux, maven, Agent.Version -gtVersion 3.225.2 #20415

Open Varorbc opened 1 month ago

Varorbc commented 1 month ago

New issue checklist

Task name

Maven@4

Task version

No response

Issue Description

Why do we need to install Maven ahead of time on the proxy instead of just using mvnw.cmd to download the needed version of Maven?

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

No response

Operation system

Ubuntu 20.04

Relevant log output

No agent found in pool Azure Pipelines which satisfies the following demand: maven. All demands: Agent.OS -equals Linux, maven, Agent.Version -gtVersion 3.225.2

Full task logs with system.debug enabled

No response

Repro steps

No response

DmitriiBobreshev commented 1 month ago

Hi @Varorbc, thank you for the question! The maven demands were added to a task to ensure that the maven is installed in the self-hosted/ms-hosted agents. It is a common practice for the in-the-box tasks to ensure that the agent will be able to execute a task properly. If you want to bypass it to run the pipeline and execute step with maven installation before the maven task, you can define new capability in user-capabilities with name "maven" to run the task on the agent where the maven is not installed.

Varorbc commented 1 month ago

@DmitriiBobreshev I feel like this doesn’t really make it ‘plug and play’—it actually makes it harder to use because Maven has to be installed on the agent beforehand. The example you mentioned with npm works right out of the box because we can use a Node task to install Node on the agent, and Node comes with npm included, so it’s truly plug and play. Note that Node doesn’t need to be pre-installed on the agent. I think the Maven task should remove the dependency requirement and work more like the Gradle or .NET tasks, where it downloads what it needs on its own, rather than requiring it to be pre-installed on the agent.