Problem scenario
You want to use an Azure pipeline. You want it to perform a build. What should you do?
Solution
Prerequisites
i. You must have a supported code versioning system with certain files. As of 10/7/19 the options are Azure Repos Git, Bitbucket Cloud, GitHub, GitHub Enterprise Server, other Git repositories or Subversion. If you follow steps 1 through 4 of How Do You Build a Java Program with Maven?, and put them in to Azure Repos Git (see "How Do You Use Azure Repositories?" if you need assistance with that), you will have satisfied the Prerequisites and can proceed directly to the procedures.
ii. You have a .yaml file in the supported code versioning system. Here is an example azure-pipelines.yml file (taken from this external site).
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
goals: 'package'
If you want assistance with Azure Repos Git, see this posting.
iii. You have a pom.xml file in the code versioning system in the same directory as the azure-pipelines.yml file.
iv. You have .java files in directories in your code versioning system that correspond with your pom.xml file.
Procedures
1. Log into Azure. Go here: https://dev.azure.com
2. Click on the project that has the repository you will use. If necessary, create a project and add a repository with the files you need.
3. Click "Pipelines" and go to "Builds"
4. Go to "New" -> "New Build Pipeline" or click "New pipeline" if you see that.
5. Click where your YAML file is (as described in the prerequisites above). If you used Azure Repos Git, click the corresponding button.
6. Click the repository name as you should see it listed.
7. For "Configure your pipeline" click "Show More"
8. Click "Maven"
9. Click "Save and run"
10. You can modify the "Commit message" if you want. Then click "Save and run".