diff options
author | Mirko Friedenhagen <mfriedenhagen@gmail.com> | 2013-12-17 02:36:12 -0800 |
---|---|---|
committer | Mirko Friedenhagen <mfriedenhagen@gmail.com> | 2013-12-17 02:36:12 -0800 |
commit | ff3074e582e809450b4aeca4535b3cb5de08ece0 (patch) | |
tree | a8926504ff862b327016c6ca11347ddef80b9415 | |
parent | 94557aa90bc58a73c1026058a0fe3edc8396bcfe (diff) | |
parent | 3da5b2b2eb7baadc020f3ffcf79305fd72b56dfb (diff) | |
download | jacoco-ff3074e582e809450b4aeca4535b3cb5de08ece0.tar.gz |
Merge pull request #169 from jacoco/issue-169
Skip jacoco instrumentation for mvn modules with package type ear.
6 files changed, 41 insertions, 0 deletions
diff --git a/jacoco-maven-plugin.test/it/it-multi-module/child-jar-without-sources/pom.xml b/jacoco-maven-plugin.test/it/it-multi-module/child-jar-without-sources/pom.xml new file mode 100644 index 00000000..4f5b10ed --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-multi-module/child-jar-without-sources/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Mirko Friedenhagen +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>jacoco</groupId> + <artifactId>it-multi-module</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <!-- report should not choke when target/classes does not exist. --> + <artifactId>child-jar-without-sources</artifactId> +</project> diff --git a/jacoco-maven-plugin.test/it/it-multi-module/pom.xml b/jacoco-maven-plugin.test/it/it-multi-module/pom.xml index d9d2302a..a9c5bc37 100644 --- a/jacoco-maven-plugin.test/it/it-multi-module/pom.xml +++ b/jacoco-maven-plugin.test/it/it-multi-module/pom.xml @@ -24,6 +24,7 @@ <modules> <module>child</module> + <module>child-jar-without-sources</module> <module>skip-child</module> </modules> diff --git a/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh b/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh index 0bebe4cb..519b4860 100644 --- a/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh +++ b/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh @@ -10,6 +10,12 @@ * *******************************************************************************/ import java.io.*; +import org.codehaus.plexus.util.*; + +String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); +if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory." ) < 0 ) { + throw new RuntimeException( "Execution should be skipped when target/classes does not exist." ); +} File dump2 = new File( basedir, "skip-child/target/jacoco.exec" ); if ( dump2.isFile() ) { diff --git a/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/main/resources/empty-file.txt b/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/main/resources/empty-file.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/main/resources/empty-file.txt diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java index 19451122..3713cd9c 100644 --- a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java +++ b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java @@ -156,6 +156,11 @@ public abstract class AbstractReportMojo extends AbstractMavenReport { getLog().info("Skipping JaCoCo execution due to missing execution data file"); return false; } + final File classesDirectory = new File(getProject().getBuild().getOutputDirectory()); + if (!classesDirectory.exists()) { + getLog().info("Skipping JaCoCo execution due to missing classes directory."); + return false; + } return true; } diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html index 53dd76b9..1c9789c1 100644 --- a/org.jacoco.doc/docroot/doc/changes.html +++ b/org.jacoco.doc/docroot/doc/changes.html @@ -20,6 +20,11 @@ <h2>Snapshot Build @qualified.bundle.version@ (@build.date@)</h2> +<h3>Fixed Bugs</h3> +<ul> + <li>Skip jacoco instrumentation for mvn modules with package type ear (GitHub #169).</li> +</ul> + <h2>Release 0.6.4 (2013/12/10)</h2> <h3>New Features</h3> |