{"id":2584,"date":"2017-12-09T07:25:26","date_gmt":"2017-12-09T07:25:26","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2584"},"modified":"2020-01-09T07:52:25","modified_gmt":"2020-01-09T07:52:25","slug":"instrumentating-class-file-using-ant-in-cobertura","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/instrumentating-class-file-using-ant-in-cobertura\/","title":{"rendered":"Instrumentating class file using Ant in Cobertura"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Instrumentating class file using Ant in Cobertura<\/strong><\/p>\n<p>Instrumentating class file using Ant in Cobertura<\/p>\n<p>Cobertura&#8217;s documentation gives the following example to show how instrumentation can be done on classes inside a jar file that is on Cobertura&#8217;s classpath.<\/p>\n<p>ANT SCRIPT<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;project&gt;<br \/>\n&lt;property name=&#8221;cobertura.dir&#8221; value=&#8221;..\/cobertura-2.0.3&#8243; \/&gt;<br \/>\n&lt;property name=&#8221;instrumented.dir&#8221; value=&#8221;..\/destination&#8221; \/&gt;<br \/>\n&lt;property name=&#8221;jars.dir&#8221; value=&#8221;..\/basedir&#8221; \/&gt;<br \/>\n&lt;property name=&#8221; cobertura.datafile &#8221; value=&#8221;..\/datafile&#8221; \/&gt;<\/p>\n<p>&lt;path id=&#8221;cobertura.classpath&#8221;&gt;<br \/>\n&lt;fileset dir=&#8221;${cobertura.dir}&#8221;&gt;<br \/>\n&lt;include name=&#8221;cobertura-2.0.3.jar&#8221; \/&gt;<br \/>\n&lt;include name=&#8221;lib\/**\/*.jar&#8221; \/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n&lt;\/path&gt;<\/p>\n<p>&lt;target name=&#8221;instrument-classes&#8221;&gt;<br \/>\n&lt;taskdef classpathref=&#8221;cobertura.classpath&#8221; resource=&#8221;tasks.properties&#8221; \/&gt;<br \/>\n&lt;delete file=&#8221;cobertura.ser&#8221; \/&gt;<\/p>\n<p>&lt;cobertura-instrument todir=&#8221;${instrumented.dir}&#8221; datafile=&#8221;${cobertura.datafile}&#8221;&gt;<br \/>\n&lt;fileset dir=&#8221;${jars.dir}&#8221;&gt;<br \/>\n&lt;include name=&#8221;XXX.jar&#8221; \/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n&lt;fileset dir=&#8221;${jars.dir}&#8221;&gt;<br \/>\n&lt;include name=&#8221;YYYY.jar&#8221; \/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n&lt;\/cobertura-instrument&gt;<br \/>\n&lt;\/target&gt;<br \/>\n&lt;\/project&gt;<\/p>\n<p>[\/code]<\/p>\n<p>FAQ \u2013<br \/>\n<a href=\"http:\/\/github.com\/cobertura\/cobertura\/wiki\/FAQ#...-coverage-everywhere\" target=\"_blank\" rel=\"noopener\">github.com\/cobertura\/cobertura\/wiki\/FAQ#&#8230;-coverage-everywhere <\/a><br \/>\n<a href=\"http:\/\/alvinalexander.com\/blog\/post\/java\/sample...ura-ant-build-script\" target=\"_blank\" rel=\"noopener\">alvinalexander.com\/blog\/post\/java\/sample&#8230;ura-ant-build-script<\/a><br \/>\n<a href=\"http:\/\/alvinalexander.com\/blog\/post\/best-practi...ertura-code-coverage\" target=\"_blank\" rel=\"noopener\">alvinalexander.com\/blog\/post\/best-practi&#8230;ertura-code-coverage <\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/12690688\/cob...ra-ant-merge-reports\" target=\"_blank\" rel=\"noopener\">stackoverflow.com\/questions\/12690688\/cob&#8230;ra-ant-merge-reports<\/a><br \/>\n<a href=\"http:\/\/mojo.codehaus.org\/cobertura-maven-plugin\/cobertura-mojo.html\" target=\"_blank\" rel=\"noopener\">mojo.codehaus.org\/cobertura-maven-plugin\/cobertura-mojo.html<\/a><\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: Instrumentating class file using Ant in Cobertura Instrumentating class file using Ant in Cobertura Cobertura&#8217;s documentation gives the following example to show how instrumentation can be&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[443],"class_list":["post-2584","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-cobertura"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2584"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2584\/revisions"}],"predecessor-version":[{"id":8533,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2584\/revisions\/8533"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}