# 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

trigger:
  branches:
    include:
    - "*"

jobs:
- job: build8
  displayName: "Build (Java 8)"
  pool:
    vmImage: ubuntu-16.04
  variables:
    jdk_version: 1.8
    artifact_suffix: ' (Java 8)'

  steps:
  - template: etc/azure-templates/build.yml
  # No coverage reports needed on Java 8
  - template: etc/azure-templates/publish-artifacts.yml

- job: build11
  displayName: "Build (Java 11)"
  pool:
    vmImage: ubuntu-16.04
  variables:
    JAVA_TOOL_OPTIONS: "-XX:+UseG1GC"  # No aggressive opts in JDK 11
    jdk_version: 1.11
    artifact_suffix: ''

  steps:
  - template: etc/azure-templates/build.yml
  - task: PublishCodeCoverageResults@1
    displayName: "Publish Coverage Results"

    inputs:
      codeCoverageTool: "jaCoCo"
      summaryFileLocation: "$(System.DefaultWorkingDirectory)/target/site/jacoco/jacoco.xml"
      reportDirectory: "$(System.DefaultWorkingDirectory)/target/site/jacoco"
      additionalCodeCoverageFiles: "$(System.DefaultWorkingDirectory)/**/jacoco.exec"
      failIfCoverageEmpty: false

  - template: etc/azure-templates/publish-artifacts.yml
  