{"action":"created","issue":{"url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/issues/77","labels_url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/issues/77/comments","events_url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/issues/77/events","html_url":"https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/pull/77","id":94318549,"number":77,"title":"Enable code coverage analysis with JaCoCo","user":{"login":"yurloc","id":673386,"avatar_url":"https://avatars.githubusercontent.com/u/673386?v=3","gravatar_id":"","url":"https://api.github.com/users/yurloc","html_url":"https://github.com/yurloc","followers_url":"https://api.github.com/users/yurloc/followers","following_url":"https://api.github.com/users/yurloc/following{/other_user}","gists_url":"https://api.github.com/users/yurloc/gists{/gist_id}","starred_url":"https://api.github.com/users/yurloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurloc/subscriptions","organizations_url":"https://api.github.com/users/yurloc/orgs","repos_url":"https://api.github.com/users/yurloc/repos","events_url":"https://api.github.com/users/yurloc/events{/privacy}","received_events_url":"https://api.github.com/users/yurloc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"psiroky","id":670547,"avatar_url":"https://avatars.githubusercontent.com/u/670547?v=3","gravatar_id":"","url":"https://api.github.com/users/psiroky","html_url":"https://github.com/psiroky","followers_url":"https://api.github.com/users/psiroky/followers","following_url":"https://api.github.com/users/psiroky/following{/other_user}","gists_url":"https://api.github.com/users/psiroky/gists{/gist_id}","starred_url":"https://api.github.com/users/psiroky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psiroky/subscriptions","organizations_url":"https://api.github.com/users/psiroky/orgs","repos_url":"https://api.github.com/users/psiroky/repos","events_url":"https://api.github.com/users/psiroky/events{/privacy}","received_events_url":"https://api.github.com/users/psiroky/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2015-07-10T14:33:16Z","updated_at":"2015-07-29T13:52:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/pulls/77","html_url":"https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/pull/77","diff_url":"https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/pull/77.diff","patch_url":"https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/pull/77.patch"},"body":"Adding JaCoCo configuration to `kie-parent-metadata` makes code coverage analysis ready to use in any droolsjbpm project. I find this potentially useful for both QA engineers and developers who want to quickly find code pieces lacking test coverage.\r\n\r\nI have introduced a simple rule that requires 90% line coverage. The plugin wil print a warning if the requirement is not met. This can be changed or the check execution can be removed completely. More interesting is the HTML report of code coverage that is generated after running\r\n\r\n```shell\r\nmvn clean verify -Djacoco\r\n```\r\n\r\nThe reports can be found in `target/site/jacoco/index.html` in any module that executed some tests.\r\n\r\nThe test execution analysis and subsequent report generation may add some 10-50% to build time (very roughly) so I put JaCoCo plugin into a profile that is not active by default. It can be activated with `-Djacoco`.\r\n\r\nSurefire upgraded so that JaCoCo agent path passed in `argLine` can be\r\ncombined with memory options for test execution ([SUREFIRE-1047](https://issues.apache.org/jira/browse/SUREFIRE-1047) fixed in 2.17)."},"comment":{"url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/issues/comments/125959256","html_url":"https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/pull/77#issuecomment-125959256","issue_url":"https://api.github.com/repos/droolsjbpm/droolsjbpm-build-bootstrap/issues/77","id":125959256,"user":{"login":"yurloc","id":673386,"avatar_url":"https://avatars.githubusercontent.com/u/673386?v=3","gravatar_id":"","url":"https://api.github.com/users/yurloc","html_url":"https://github.com/yurloc","followers_url":"https://api.github.com/users/yurloc/followers","following_url":"https://api.github.com/users/yurloc/following{/other_user}","gists_url":"https://api.github.com/users/yurloc/gists{/gist_id}","starred_url":"https://api.github.com/users/yurloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurloc/subscriptions","organizations_url":"https://api.github.com/users/yurloc/orgs","repos_url":"https://api.github.com/users/yurloc/repos","events_url":"https://api.github.com/users/yurloc/events{/privacy}","received_events_url":"https://api.github.com/users/yurloc/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T13:52:13Z","updated_at":"2015-07-29T13:52:13Z","body":"> Why add \"-Djacoco\" (and a special profile to make it work), why not simply call the goal directly \"mvn jacoco:jacoco\" (or \"mvn clean install jacoco:jacoco\")?\r\n\r\n@ge0ffrey There is no \"jacoco\" goal in jacoco plugin. A meaningful usage of the plugin involves 2 stages:\r\n\r\n1. `prepare-agent` goal runs before test execution. As a result runtime agent is attached to surefire and code coverage analysis is produced after tests are executed\r\n\r\n2. At least on of the following (after test phase):\r\n  - `check` verifies that code coverage meets defined criteria\r\n  - `report` produces a graphical (HTML) report of the code coverage\r\n\r\nIt is possible to get the analysis with one Maven execution (`mvn clean test`) and that generate report in another execution (`mvn jacoco:report`). On the other hand, `mvn jacoco:check` fails due to missing `rules` configuration (it seems that POM configuration is ignored when invoking the goal like this). All in all it seem the only possible way to perform both `check` and `report` is to run `mvn clean verify`.\r\n\r\nRegarding the new profile -- its purpose is to make code coverage analysis and report generation optional so that it doesn't slow regular builds."}}