1 /******************************************************************************* 2 * Copyright (c) 2009, 2015 Mountainminds GmbH & Co. KG and Contributors 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Evgeny Mandrikov - initial API and implementation 10 * Kyle Lieber - implementation of CheckMojo 11 * 12 *******************************************************************************/ 13 package org.jacoco.maven; 14 15 import java.io.File; 16 import java.util.Locale; 17 18 /** 19 * Same as <code>report</code>, but provides default values suitable for 20 * integration-tests: 21 * <ul> 22 * <li>bound to <code>report-integration</code> phase</li> 23 * <li>different <code>dataFile</code></li> 24 * </ul> 25 * 26 * @phase verify 27 * @goal report-integration 28 * @requiresProject true 29 * @threadSafe 30 * @since 0.6.4 31 */ 32 public class ReportITMojo extends AbstractReportMojo { 33 34 /** 35 * Output directory for the reports. Note that this parameter is only 36 * relevant if the goal is run from the command line or from the default 37 * build lifecycle. If the goal is run indirectly as part of a site 38 * generation, the output directory configured in the Maven Site Plugin is 39 * used instead. 40 * 41 * @parameter default-value="${project.reporting.outputDirectory}/jacoco-it" 42 */ 43 private File outputDirectory; 44 45 /** 46 * File with execution data. 47 * 48 * @parameter default-value="${project.build.directory}/jacoco-it.exec" 49 */ 50 private File dataFile; 51 52 @Override getOutputDirectory()53 protected String getOutputDirectory() { 54 return outputDirectory.getAbsolutePath(); 55 } 56 57 @Override setReportOutputDirectory(final File reportOutputDirectory)58 public void setReportOutputDirectory(final File reportOutputDirectory) { 59 if (reportOutputDirectory != null 60 && !reportOutputDirectory.getAbsolutePath().endsWith( 61 "jacoco-it")) { 62 outputDirectory = new File(reportOutputDirectory, "jacoco-it"); 63 } else { 64 outputDirectory = reportOutputDirectory; 65 } 66 } 67 68 @Override getDataFile()69 File getDataFile() { 70 return dataFile; 71 } 72 73 @Override getOutputDirectoryFile()74 File getOutputDirectoryFile() { 75 return outputDirectory; 76 } 77 78 @Override getOutputName()79 public String getOutputName() { 80 return "jacoco-it/index"; 81 } 82 83 @Override getName(final Locale locale)84 public String getName(final Locale locale) { 85 return "JaCoCo IT"; 86 } 87 } 88