AZ-400 Practice Question: Design and implement build and release pipelines
Your team uses Azure Pipelines to build a Java application. The build must produce a JAR file and publish it as a pipeline artifact. Which THREE steps should be included in the build pipeline?
⚠ Common exam trap
A common mix-up: candidates confuse the DotNetCoreCLI or NuGetCommand tasks with Java tooling, or assume any packaging task works for any language, but Azure Pipelines tasks are language-specific and must match the build toolchain.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use a Maven or Gradle task to compile and package the application.
A Maven or Gradle task is the standard way to compile and package a Java application into a JAR file. These tasks invoke the build tool's lifecycle (e.g., `mvn package` or `gradle build`) to produce the artifact, which is a prerequisite for publishing.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Use a Maven or Gradle task to compile and package the application.
Why this is correct
The Maven/Gradle task is the correct Java build step: it invokes the project's build tool (e.g., `mvn clean package` or `gradle build`), compiles the Java sources, runs tests, and packages the output into a deployable JAR (or WAR). Without this task, no Java artifact exists to publish.
- ✗
Use the DotNetCoreCLI task to build the application.
Why it's wrong here
The DotNetCoreCLI task is specifically designed for .NET Core projects; it runs commands like `dotnet build` or `dotnet publish` against .csproj/.sln files. It cannot compile Java code or invoke Maven/Gradle, so using it in a Java pipeline would fail and is therefore incorrect.
- ✓
Use the Publish Build Artifacts task to upload the staging directory.
Why this is correct
The Publish Build Artifacts task uploads the contents of `$(Build.ArtifactStagingDirectory)` to Azure Pipelines, making the packaged JAR available as a downloadable artifact and to downstream release pipelines. This is the final step that persists the built Java application after preceding copy tasks have staged it.
- ✓
Use the Copy Files task to copy the JAR to $(Build.ArtifactStagingDirectory).
Why this is correct
The Copy Files task is correct because it copies the generated JAR (e.g., from `target/*.jar` or `build/libs/*.jar`) into the `$(Build.ArtifactStagingDirectory)`, which is the predefined staging folder Azure Pipelines expects for artifact publication. This ensures the artifact is in the right location before the Publish Build Artifacts task uploads it.
- ✗
Use the NuGetCommand task to pack the JAR.
Why it's wrong here
The NuGetCommand task is used to pack, restore, or push .NET NuGet packages (`.nupkg` files), not Java JARs. Java projects use Maven or Gradle packaging, so NuGetCommand would be incompatible and cannot produce a valid JAR artifact, making it incorrect for this scenario.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
Artifact
An artifact is any file or package produced during the software development process that is used to deploy, test, or run an application.
Key term
Azure Pipelines
Azure Pipelines is a cloud-based CI/CD service from Microsoft that automatically builds, tests, and deploys code to any platform or cloud.
About these practice questions
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.