{"action":"created","comment":{"url":"https://api.github.com/repos/jacoco/jacoco/pulls/comments/57302483","id":57302483,"diff_hunk":"@@ -0,0 +1,163 @@\n+/*******************************************************************************\n+ * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors\n+ * All rights reserved. This program and the accompanying materials\n+ * are made available under the terms of the Eclipse Public License v1.0\n+ * which accompanies this distribution, and is available at\n+ * http://www.eclipse.org/legal/epl-v10.html\n+ *\n+ * Contributors:\n+ *    John Oliver, Marc R. Hoffmann, Jan Wloka - initial API and implementation\n+ *\n+ *******************************************************************************/\n+package org.jacoco.maven;\n+\n+import java.io.File;\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.List;\n+import java.util.Locale;\n+\n+import org.apache.maven.artifact.Artifact;\n+import org.apache.maven.model.Dependency;\n+import org.apache.maven.project.MavenProject;\n+import org.apache.maven.reporting.MavenReportException;\n+import org.jacoco.core.analysis.IBundleCoverage;\n+import org.jacoco.core.tools.ExecFileLoader;\n+import org.jacoco.report.IReportGroupVisitor;\n+import org.jacoco.report.IReportVisitor;\n+\n+/**\n+ * <p>\n+ * Creates a structured code coverage report from multiple projects (HTML, XML,\n+ * and CSV). The report is created from all modules this project depends on.\n+ * From those projects class and source files as well as JaCoCo execution data\n+ * files will be collected. This also allows to create coverage reports when\n+ * tests are in separate projects than the code under test, for example in case\n+ * of integration tests.\n+ * </p>\n+ * \n+ * <p>\n+ * Using the dependency scope allows to distinguish projects which contribute\n+ * execution data but should not be part of the report itself:\n+ * </p>\n+ * \n+ * <ul>\n+ * <li><code>compile</code>: Project source and execution data is included in\n+ * the report.</li>\n+ * <li><code>test</code>: Only execution data is considered for the report.</li>\n+ * </ul>\n+ * \n+ * @goal report-aggregate\n+ * @since 0.7.7\n+ */\n+public class ReportAggregateMojo extends ReportMojo {\n+\n+\t/**\n+\t * The projects in the reactor.\n+\t * \n+\t * @parameter expression=\"${reactorProjects}\"\n+\t * @readonly\n+\t */\n+\tprivate List<MavenProject> reactorProjects;\n+\n+\t@Override\n+\tpublic boolean canGenerateReport() {\n+\t\tif (skip) {\n+\t\t\tgetLog().info(\"Skipping JaCoCo execution\");\n+\t\t\treturn false;\n+\t\t}\n+\t\treturn true;\n+\t}\n+\n+\t@Override\n+\tprotected void executeReport(final Locale locale)\n+\t\t\tthrows MavenReportException {\n+\t\tloadExecutionData();\n+\t\ttry {\n+\t\t\tfinal IReportVisitor visitor = createVisitor(locale);\n+\t\t\tvisitor.visitInfo(sessionInfoStore.getInfos(),\n+\t\t\t\t\texecutionDataStore.getContents());\n+\t\t\tcreateReport(visitor);\n+\t\t\tvisitor.visitEnd();\n+\t\t} catch (final IOException e) {\n+\t\t\tthrow new MavenReportException(\"Error while creating report: \"\n+\t\t\t\t\t+ e.getMessage(), e);\n+\t\t}\n+\t}\n+\n+\t@Override\n+\tvoid createReport(final IReportGroupVisitor visitor) throws IOException {\n+\t\tfinal IReportGroupVisitor group = visitor.visitGroup(getProject()\n+\t\t\t\t.getName());\n+\t\tfor (final MavenProject dependency : findDependencies(Artifact.SCOPE_COMPILE)) {\n+\t\t\tcreateReportForProject(dependency, group);\n+\t\t}\n+\t}\n+\n+\tvoid createReportForProject(final MavenProject project,\n+\t\t\tfinal IReportGroupVisitor visitor) throws IOException {\n+\n+\t\tfinal FileFilter fileFilter = new FileFilter(this.getIncludes(),\n+\t\t\t\tthis.getExcludes());\n+\t\tfinal BundleCreator creator = new BundleCreator(project, fileFilter,\n+\t\t\t\tgetLog());\n+\t\tfinal IBundleCoverage bundle = creator.createBundle(executionDataStore);\n+\t\t// TODO use source encoding of target project\n+\t\tfinal SourceFileCollection locator = new SourceFileCollection(\n+\t\t\t\tgetCompileSourceRoots(project), sourceEncoding);\n+\t\tcheckForMissingDebugInformation(bundle);\n+\t\tvisitor.visitBundle(bundle, locator);\n+\t}\n+\n+\t@Override\n+\tvoid loadExecutionData() throws MavenReportException {\n+\t\tfinal ExecFileLoader loader = new ExecFileLoader();\n+\t\tfor (final MavenProject dependency : findDependencies(\n+\t\t\t\tArtifact.SCOPE_COMPILE, Artifact.SCOPE_TEST)) {\n+\t\t\t// TODO Use configured location from project\n+\t\t\t// TODO Clarify when to include exec data from integration tests\n+\t\t\tfinal File execFile = new File(\n+\t\t\t\t\tdependency.getBuild().getDirectory(), \"jacoco.exec\");","path":"jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java","position":121,"original_position":121,"commit_id":"b3318a9812c4e175b4af72a3887138ce4e6ec1e6","original_commit_id":"2401392a76300674ff80143a1b6add2a3de5d084","user":{"login":"mfriedenhagen","id":125281,"avatar_url":"https://avatars.githubusercontent.com/u/125281?v=3","gravatar_id":"","url":"https://api.github.com/users/mfriedenhagen","html_url":"https://github.com/mfriedenhagen","followers_url":"https://api.github.com/users/mfriedenhagen/followers","following_url":"https://api.github.com/users/mfriedenhagen/following{/other_user}","gists_url":"https://api.github.com/users/mfriedenhagen/gists{/gist_id}","starred_url":"https://api.github.com/users/mfriedenhagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfriedenhagen/subscriptions","organizations_url":"https://api.github.com/users/mfriedenhagen/orgs","repos_url":"https://api.github.com/users/mfriedenhagen/repos","events_url":"https://api.github.com/users/mfriedenhagen/events{/privacy}","received_events_url":"https://api.github.com/users/mfriedenhagen/received_events","type":"User","site_admin":false},"body":"Not sure how retrieving the location could be done, but IMO one of the primary use cases for aggregated reports are integration tests which typically use `jacoco-it.exec` by default, so I would revert the default here?","created_at":"2016-03-24T11:09:04Z","updated_at":"2016-03-24T11:09:04Z","html_url":"https://github.com/jacoco/jacoco/pull/388#discussion_r57302483","pull_request_url":"https://api.github.com/repos/jacoco/jacoco/pulls/388","_links":{"self":{"href":"https://api.github.com/repos/jacoco/jacoco/pulls/comments/57302483"},"html":{"href":"https://github.com/jacoco/jacoco/pull/388#discussion_r57302483"},"pull_request":{"href":"https://api.github.com/repos/jacoco/jacoco/pulls/388"}}},"pull_request":{"url":"https://api.github.com/repos/jacoco/jacoco/pulls/388","id":63790317,"html_url":"https://github.com/jacoco/jacoco/pull/388","diff_url":"https://github.com/jacoco/jacoco/pull/388.diff","patch_url":"https://github.com/jacoco/jacoco/pull/388.patch","issue_url":"https://api.github.com/repos/jacoco/jacoco/issues/388","number":388,"state":"open","locked":false,"title":"Aggregate Report Maven Goal","user":{"login":"marchof","id":1936262,"avatar_url":"https://avatars.githubusercontent.com/u/1936262?v=3","gravatar_id":"","url":"https://api.github.com/users/marchof","html_url":"https://github.com/marchof","followers_url":"https://api.github.com/users/marchof/followers","following_url":"https://api.github.com/users/marchof/following{/other_user}","gists_url":"https://api.github.com/users/marchof/gists{/gist_id}","starred_url":"https://api.github.com/users/marchof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marchof/subscriptions","organizations_url":"https://api.github.com/users/marchof/orgs","repos_url":"https://api.github.com/users/marchof/repos","events_url":"https://api.github.com/users/marchof/events{/privacy}","received_events_url":"https://api.github.com/users/marchof/received_events","type":"User","site_admin":false},"body":"To finally offer a solution for multi module Maven projects (#18) I did a detailed analysis of the issue together with @jwloka. We documented the results here:\r\n\r\nhttps://github.com/jacoco/jacoco/wiki/MavenMultiModule\r\n\r\nAs part of the analysis we also reviewed the existing PR #97. We came up with a different solution which should cover the described use cases and should be more robust in terms of build configuration and execution.\r\n\r\nPlease feel free to add comments regarding the general approach as well as the implementation","created_at":"2016-03-22T20:48:42Z","updated_at":"2016-03-24T11:09:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92583cf9541ce2084f30c66b144c2b72ec0a0753","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jacoco/jacoco/pulls/388/commits","review_comments_url":"https://api.github.com/repos/jacoco/jacoco/pulls/388/comments","review_comment_url":"https://api.github.com/repos/jacoco/jacoco/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jacoco/jacoco/issues/388/comments","statuses_url":"https://api.github.com/repos/jacoco/jacoco/statuses/b3318a9812c4e175b4af72a3887138ce4e6ec1e6","head":{"label":"jacoco:issue-388","ref":"issue-388","sha":"b3318a9812c4e175b4af72a3887138ce4e6ec1e6","user":{"login":"jacoco","id":1939631,"avatar_url":"https://avatars.githubusercontent.com/u/1939631?v=3","gravatar_id":"","url":"https://api.github.com/users/jacoco","html_url":"https://github.com/jacoco","followers_url":"https://api.github.com/users/jacoco/followers","following_url":"https://api.github.com/users/jacoco/following{/other_user}","gists_url":"https://api.github.com/users/jacoco/gists{/gist_id}","starred_url":"https://api.github.com/users/jacoco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacoco/subscriptions","organizations_url":"https://api.github.com/users/jacoco/orgs","repos_url":"https://api.github.com/users/jacoco/repos","events_url":"https://api.github.com/users/jacoco/events{/privacy}","received_events_url":"https://api.github.com/users/jacoco/received_events","type":"Organization","site_admin":false},"repo":{"id":4950187,"name":"jacoco","full_name":"jacoco/jacoco","owner":{"login":"jacoco","id":1939631,"avatar_url":"https://avatars.githubusercontent.com/u/1939631?v=3","gravatar_id":"","url":"https://api.github.com/users/jacoco","html_url":"https://github.com/jacoco","followers_url":"https://api.github.com/users/jacoco/followers","following_url":"https://api.github.com/users/jacoco/following{/other_user}","gists_url":"https://api.github.com/users/jacoco/gists{/gist_id}","starred_url":"https://api.github.com/users/jacoco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacoco/subscriptions","organizations_url":"https://api.github.com/users/jacoco/orgs","repos_url":"https://api.github.com/users/jacoco/repos","events_url":"https://api.github.com/users/jacoco/events{/privacy}","received_events_url":"https://api.github.com/users/jacoco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jacoco/jacoco","description":":microscope: JaCoCo - Java Code Coverage Library","fork":false,"url":"https://api.github.com/repos/jacoco/jacoco","forks_url":"https://api.github.com/repos/jacoco/jacoco/forks","keys_url":"https://api.github.com/repos/jacoco/jacoco/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacoco/jacoco/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacoco/jacoco/teams","hooks_url":"https://api.github.com/repos/jacoco/jacoco/hooks","issue_events_url":"https://api.github.com/repos/jacoco/jacoco/issues/events{/number}","events_url":"https://api.github.com/repos/jacoco/jacoco/events","assignees_url":"https://api.github.com/repos/jacoco/jacoco/assignees{/user}","branches_url":"https://api.github.com/repos/jacoco/jacoco/branches{/branch}","tags_url":"https://api.github.com/repos/jacoco/jacoco/tags","blobs_url":"https://api.github.com/repos/jacoco/jacoco/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacoco/jacoco/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacoco/jacoco/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacoco/jacoco/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacoco/jacoco/statuses/{sha}","languages_url":"https://api.github.com/repos/jacoco/jacoco/languages","stargazers_url":"https://api.github.com/repos/jacoco/jacoco/stargazers","contributors_url":"https://api.github.com/repos/jacoco/jacoco/contributors","subscribers_url":"https://api.github.com/repos/jacoco/jacoco/subscribers","subscription_url":"https://api.github.com/repos/jacoco/jacoco/subscription","commits_url":"https://api.github.com/repos/jacoco/jacoco/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacoco/jacoco/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacoco/jacoco/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacoco/jacoco/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacoco/jacoco/contents/{+path}","compare_url":"https://api.github.com/repos/jacoco/jacoco/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacoco/jacoco/merges","archive_url":"https://api.github.com/repos/jacoco/jacoco/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacoco/jacoco/downloads","issues_url":"https://api.github.com/repos/jacoco/jacoco/issues{/number}","pulls_url":"https://api.github.com/repos/jacoco/jacoco/pulls{/number}","milestones_url":"https://api.github.com/repos/jacoco/jacoco/milestones{/number}","notifications_url":"https://api.github.com/repos/jacoco/jacoco/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacoco/jacoco/labels{/name}","releases_url":"https://api.github.com/repos/jacoco/jacoco/releases{/id}","deployments_url":"https://api.github.com/repos/jacoco/jacoco/deployments","created_at":"2012-07-08T21:45:13Z","updated_at":"2016-03-23T10:27:20Z","pushed_at":"2016-03-23T21:59:14Z","git_url":"git://github.com/jacoco/jacoco.git","ssh_url":"git@github.com:jacoco/jacoco.git","clone_url":"https://github.com/jacoco/jacoco.git","svn_url":"https://github.com/jacoco/jacoco","homepage":"http://www.eclemma.org/jacoco/","size":15662,"stargazers_count":455,"watchers_count":455,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":185,"mirror_url":null,"open_issues_count":61,"forks":185,"open_issues":61,"watchers":455,"default_branch":"master"}},"base":{"label":"jacoco:master","ref":"master","sha":"ea2f49f6c77730315b9bd72607108482c932eb83","user":{"login":"jacoco","id":1939631,"avatar_url":"https://avatars.githubusercontent.com/u/1939631?v=3","gravatar_id":"","url":"https://api.github.com/users/jacoco","html_url":"https://github.com/jacoco","followers_url":"https://api.github.com/users/jacoco/followers","following_url":"https://api.github.com/users/jacoco/following{/other_user}","gists_url":"https://api.github.com/users/jacoco/gists{/gist_id}","starred_url":"https://api.github.com/users/jacoco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacoco/subscriptions","organizations_url":"https://api.github.com/users/jacoco/orgs","repos_url":"https://api.github.com/users/jacoco/repos","events_url":"https://api.github.com/users/jacoco/events{/privacy}","received_events_url":"https://api.github.com/users/jacoco/received_events","type":"Organization","site_admin":false},"repo":{"id":4950187,"name":"jacoco","full_name":"jacoco/jacoco","owner":{"login":"jacoco","id":1939631,"avatar_url":"https://avatars.githubusercontent.com/u/1939631?v=3","gravatar_id":"","url":"https://api.github.com/users/jacoco","html_url":"https://github.com/jacoco","followers_url":"https://api.github.com/users/jacoco/followers","following_url":"https://api.github.com/users/jacoco/following{/other_user}","gists_url":"https://api.github.com/users/jacoco/gists{/gist_id}","starred_url":"https://api.github.com/users/jacoco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacoco/subscriptions","organizations_url":"https://api.github.com/users/jacoco/orgs","repos_url":"https://api.github.com/users/jacoco/repos","events_url":"https://api.github.com/users/jacoco/events{/privacy}","received_events_url":"https://api.github.com/users/jacoco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jacoco/jacoco","description":":microscope: JaCoCo - Java Code Coverage Library","fork":false,"url":"https://api.github.com/repos/jacoco/jacoco","forks_url":"https://api.github.com/repos/jacoco/jacoco/forks","keys_url":"https://api.github.com/repos/jacoco/jacoco/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacoco/jacoco/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacoco/jacoco/teams","hooks_url":"https://api.github.com/repos/jacoco/jacoco/hooks","issue_events_url":"https://api.github.com/repos/jacoco/jacoco/issues/events{/number}","events_url":"https://api.github.com/repos/jacoco/jacoco/events","assignees_url":"https://api.github.com/repos/jacoco/jacoco/assignees{/user}","branches_url":"https://api.github.com/repos/jacoco/jacoco/branches{/branch}","tags_url":"https://api.github.com/repos/jacoco/jacoco/tags","blobs_url":"https://api.github.com/repos/jacoco/jacoco/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacoco/jacoco/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacoco/jacoco/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacoco/jacoco/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacoco/jacoco/statuses/{sha}","languages_url":"https://api.github.com/repos/jacoco/jacoco/languages","stargazers_url":"https://api.github.com/repos/jacoco/jacoco/stargazers","contributors_url":"https://api.github.com/repos/jacoco/jacoco/contributors","subscribers_url":"https://api.github.com/repos/jacoco/jacoco/subscribers","subscription_url":"https://api.github.com/repos/jacoco/jacoco/subscription","commits_url":"https://api.github.com/repos/jacoco/jacoco/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacoco/jacoco/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacoco/jacoco/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacoco/jacoco/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacoco/jacoco/contents/{+path}","compare_url":"https://api.github.com/repos/jacoco/jacoco/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacoco/jacoco/merges","archive_url":"https://api.github.com/repos/jacoco/jacoco/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacoco/jacoco/downloads","issues_url":"https://api.github.com/repos/jacoco/jacoco/issues{/number}","pulls_url":"https://api.github.com/repos/jacoco/jacoco/pulls{/number}","milestones_url":"https://api.github.com/repos/jacoco/jacoco/milestones{/number}","notifications_url":"https://api.github.com/repos/jacoco/jacoco/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacoco/jacoco/labels{/name}","releases_url":"https://api.github.com/repos/jacoco/jacoco/releases{/id}","deployments_url":"https://api.github.com/repos/jacoco/jacoco/deployments","created_at":"2012-07-08T21:45:13Z","updated_at":"2016-03-23T10:27:20Z","pushed_at":"2016-03-23T21:59:14Z","git_url":"git://github.com/jacoco/jacoco.git","ssh_url":"git@github.com:jacoco/jacoco.git","clone_url":"https://github.com/jacoco/jacoco.git","svn_url":"https://github.com/jacoco/jacoco","homepage":"http://www.eclemma.org/jacoco/","size":15662,"stargazers_count":455,"watchers_count":455,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":185,"mirror_url":null,"open_issues_count":61,"forks":185,"open_issues":61,"watchers":455,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jacoco/jacoco/pulls/388"},"html":{"href":"https://github.com/jacoco/jacoco/pull/388"},"issue":{"href":"https://api.github.com/repos/jacoco/jacoco/issues/388"},"comments":{"href":"https://api.github.com/repos/jacoco/jacoco/issues/388/comments"},"review_comments":{"href":"https://api.github.com/repos/jacoco/jacoco/pulls/388/comments"},"review_comment":{"href":"https://api.github.com/repos/jacoco/jacoco/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jacoco/jacoco/pulls/388/commits"},"statuses":{"href":"https://api.github.com/repos/jacoco/jacoco/statuses/b3318a9812c4e175b4af72a3887138ce4e6ec1e6"}}}}