aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Mandrikov <Godin@users.noreply.github.com>2016-06-11 13:51:33 +0200
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2016-06-11 13:51:33 +0200
commit209b27c0d2ec7dcf75c08edbc0a434fcf929db52 (patch)
tree19744e9b81fbd16d0a38ba8c28687e4aba952c39
parent28d5985b2bd4df01ecf7838a2e4a3a9b7b7cbdc9 (diff)
downloadjacoco-209b27c0d2ec7dcf75c08edbc0a434fcf929db52.tar.gz
report mojo: add user property for parameter dataFile (#322)
-rw-r--r--jacoco-maven-plugin.test/it/it-customize-agent/pom.xml3
-rw-r--r--jacoco-maven-plugin.test/it/it-customize-agent/src/main/java/Example.java18
-rw-r--r--jacoco-maven-plugin.test/it/it-customize-agent/src/test/java/ExampleTest.java21
-rw-r--r--jacoco-maven-plugin.test/it/it-customize-agent/verify.bsh6
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java2
-rw-r--r--org.jacoco.doc/docroot/doc/changes.html7
6 files changed, 56 insertions, 1 deletions
diff --git a/jacoco-maven-plugin.test/it/it-customize-agent/pom.xml b/jacoco-maven-plugin.test/it/it-customize-agent/pom.xml
index 5f3b6532..afef34f8 100644
--- a/jacoco-maven-plugin.test/it/it-customize-agent/pom.xml
+++ b/jacoco-maven-plugin.test/it/it-customize-agent/pom.xml
@@ -35,6 +35,8 @@
<jacoco.port>9999</jacoco.port>
<jacoco.classDumpDir>${project.build.directory}/classdumps</jacoco.classDumpDir>
<jacoco.jmx>true</jacoco.jmx>
+
+ <jacoco.dataFile>${jacoco.destFile}</jacoco.dataFile>
</properties>
<build>
@@ -46,6 +48,7 @@
<execution>
<goals>
<goal>prepare-agent</goal>
+ <goal>report</goal>
</goals>
<configuration>
<includes>
diff --git a/jacoco-maven-plugin.test/it/it-customize-agent/src/main/java/Example.java b/jacoco-maven-plugin.test/it/it-customize-agent/src/main/java/Example.java
new file mode 100644
index 00000000..833ff9ae
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-customize-agent/src/main/java/Example.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2016 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+public class Example {
+
+ public void sayHello() {
+ System.out.println("Hello world");
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-customize-agent/src/test/java/ExampleTest.java b/jacoco-maven-plugin.test/it/it-customize-agent/src/test/java/ExampleTest.java
new file mode 100644
index 00000000..b225c799
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-customize-agent/src/test/java/ExampleTest.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2016 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+import org.junit.Test;
+
+public class ExampleTest {
+
+ @Test
+ public void test() {
+ new Example().sayHello();
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-customize-agent/verify.bsh b/jacoco-maven-plugin.test/it/it-customize-agent/verify.bsh
index 7dc56e50..b04d4005 100644
--- a/jacoco-maven-plugin.test/it/it-customize-agent/verify.bsh
+++ b/jacoco-maven-plugin.test/it/it-customize-agent/verify.bsh
@@ -39,3 +39,9 @@ if ( !file.isFile() )
{
throw new FileNotFoundException( "Could not find generated dump: " + file );
}
+
+File reportDir = new File( basedir, "target/site/jacoco" );
+if ( !reportDir.isDirectory() )
+{
+ throw new RuntimeException( "Could not find generated report" );
+}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java
index 92599a4f..4bf99fcf 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java
@@ -42,7 +42,7 @@ public class ReportMojo extends AbstractReportMojo {
/**
* File with execution data.
*/
- @Parameter(defaultValue = "${project.build.directory}/jacoco.exec")
+ @Parameter(property = "jacoco.dataFile", defaultValue = "${project.build.directory}/jacoco.exec")
private File dataFile;
@Override
diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index c36b5649..61bbf98b 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -20,6 +20,13 @@
<h2>Snapshot Build @qualified.bundle.version@ (@build.date@)</h2>
+<h3>New Features</h3>
+<ul>
+ <li>User property <code>jacoco.dataFile</code> for parameter <code>dataFile</code>
+ of Maven <code>report</code> goal
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/322">#322</a>).</li>
+</ul>
+
<h2>Release 0.7.7 (2016/06/06)</h2>
<h3>New Features</h3>