title: Code coverage report using gitlab-ci.yml file
body: <p>I need to see code coverage report for a java maven project in Gitlab.
  According to <a href="https://medium.com/@kaiwinter/javafx-and-code-coverage-on-gitlab-ci-29c690e03fd6" rel="noreferrer">this</a>, <a href="https://blog.gojekengineering.com/code-coverage-from-failing-the-build-to-publishing-the-report-with-gitlab-pages-a1d9a6a414c0" rel="noreferrer">this</a> and some other sources:</p>
  <ol>
  <li>I added <code>jacoco</code> to the list of plugins in <code>pom.xml</code>.</li>
  <li>Added pages job to my <code>.gitlab-ci.yml</code> file.</li>
  <li>Added <code>Total.*?([0-9]{1,3})%</code> to code coverage parsing in project setting.</li>
  </ol>
  <p>but there isn't any coverage report or at least I can't see it. There is no coverage percentage or coverage report page.</p>
  <p>Content of <code>.gitlab-ci.yml</code> file:</p>
  <pre><code>image: maven:latest
  
  variables:
    MAVEN_CLI_OPTS: &quot;--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true&quot;
    MAVEN_OPTS: &quot;-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true&quot;
  
  cache:
    paths:
      - .m2/repository/
  
  build:
    stage: build
    script:
      - mvn $MAVEN_CLI_OPTS compile
  
  test:
    stage: test
    script:
      - mvn $MAVEN_CLI_OPTS test
    artifacts:
      paths:
        - target/site/jacoco/
  pages:
    stage: deploy
    dependencies:
      - test
    script:
     - mkdir public
     - mv target/site/jacoco/index.html public
    artifacts:
      paths:
        - public
  
  deploy:
    stage: deploy
    script:
      - mvn $MAVEN_CLI_OPTS verify
    only:
      - master
  </code></pre>
  <p><code>jacoco</code> plugin in <code>pom.xml</code>:</p>
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
      &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;0.7.5.201505241946&lt;/version&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;pre-unit-test&lt;/id&gt;
              &lt;goals&gt;
                  &lt;goal&gt;prepare-agent&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
              &lt;id&gt;post-unit-test&lt;/id&gt;
              &lt;phase&gt;test&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;report&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  <p>My Project is a private project on <code>gitlab.com</code>.</p>
  <p>Pipeline and its all 4 jobs passed successfully.</p>
  <p>How can I see the coverage reports?</p>