[WARNING] No files to instrument. in cobertura plug in

AnjaliW
AnjaliW used Ask the Experts™
on
I am doing following things:
1.compiling Junits.( generates classes in target/test_classes/)
2.Generats Junit reports (at \target\surefire-reports\)
3.run code coverage.
No idea why it is not finding any classes available in  target/test_classes/ (junits's classes location).
4.running command "mvn test cobertura:instrument -e -X >>out.log "

Issue:

1.No code coverag report generates.
2.looking classes in target/generated_classes location (Why??), (folder is empty).

Attaching pom.xml.

Logs are:

DEBUG]   (s) pattern = D:\code\project\testprojects\com.ofss.fc.junit.test/testprojects/com/ofss/fc/junit/test/lending/core/lrm/*.class
[DEBUG]   (s) branchRate = 90
[DEBUG]   (s) lineRate = 80
[DEBUG]   (s) regexes = [D:\code\project\testprojects\com.ofss.fc.junit.test/testprojects/com/ofss/fc/junit/test/lending/core/lrm/*.class:80:90]
[DEBUG]   (f) check = org.codehaus.mojo.cobertura.configuration.ConfigCheck@2be26d42
[DEBUG]   (f) classifier = cobertura
[DEBUG]   (f) dataFile = D:\code\project\testprojects\com.ofss.fc.junit.test\target\cobertura\cobertura.ser
[DEBUG]   (f) forceMojoExecution = false
[DEBUG]   (f) includes = [D://code/project/testprojects/com.ofss.fc.junit.test/target/test-classes/com/ofss/fc/junit/test/lending/core/lrm/*Test.class]
[DEBUG]   (f) instrumentation = <ConfigInstrumentation basedir="D:\code" includes="D://code/project/testprojects/com.ofss.fc.junit.test/target/test-classes/com/ofss/fc/junit/test/lending/core/lrm/*Test.class" maxmem="64m" />
[DEBUG]   (f) maxmem = 1024m
[DEBUG]   (f) pluginClasspathList = [org.codehaus.mojo:cobertura-maven-plugin:maven-plugin:2.5:, net.sourceforge.cobertura:cobertura:jar:1.9.4.1:compile, oro:oro:jar:2.0.8:compile, asm:asm:jar:3.0:compile, asm:asm-tree:jar:3.0:compile, log4j:log4j:jar:1.2.9:compile, org.apache.ant:ant:jar:1.7.0:compile, org.apache.ant:ant-launcher:jar:1.7.0:compile, net.sourceforge.cobertura:cobertura-runtime:pom:1.9.4.1:compile, urbanophile:java-getopt:jar:1.0.9:compile, org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile, org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile, org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4.2:compile, commons-validator:commons-validator:jar:1.2.0:compile, commons-beanutils:commons-beanutils:jar:1.7.0:compile, commons-digester:commons-digester:jar:1.6:compile, commons-logging:commons-logging:jar:1.0.4:compile, xml-apis:xml-apis:jar:1.0.b2:compile, org.apache.maven.doxia:doxia-core:jar:1.0:compile, org.apache.maven.doxia:doxia-site-renderer:jar:1.0:compile, org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile, org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile, org.apache.velocity:velocity:jar:1.5:compile, org.apache.maven.doxia:doxia-decoration-model:jar:1.0:compile, commons-collections:commons-collections:jar:3.2:compile, org.apache.maven.doxia:doxia-module-apt:jar:1.0:compile, org.apache.maven.doxia:doxia-module-fml:jar:1.0:compile, org.apache.maven.doxia:doxia-module-xdoc:jar:1.0:compile, org.apache.maven.doxia:doxia-module-xhtml:jar:1.0:compile, commons-lang:commons-lang:jar:2.4:compile, org.codehaus.plexus:plexus-utils:jar:2.0.2:compile, org.apache.maven.shared:maven-invoker:jar:2.0.11:compile]
[DEBUG]   (f) project = MavenProject: ngp.flexcube.com.ofss.fc.cz.nab.application:com.ofss.fc.junit.test:1.0 @ D:\code\project\testprojects\com.ofss.fc.junit.test\pom.xml
[DEBUG]   (f) quiet = false
[DEBUG]   (f) skip = false
[DEBUG] -- end configuration --
[DEBUG] Config : <ConfigInstrumentation basedir="D:\code\project\testprojects\com.ofss.fc.junit.test\target\generated-classes\cobertura" includes="D://code/project/testprojects/com.ofss.fc.junit.test/target/test-classes/com/ofss/fc/junit/test/lending/core/lrm/*Test.class" maxmem="64m" />
[DEBUG] Basedir: D:\code\project\testprojects\com.ofss.fc.junit.test\target\generated-classes\cobertura
[DEBUG] Include: D://code/project/testprojects/com.ofss.fc.junit.test/target/test-classes/com/ofss/fc/junit/test/lending/core/lrm/*Test.class
[DEBUG] Exclude: **/*~,**/#*#,**/.#*,**/%*%,**/._*,**/CVS,**/CVS/**,**/.cvsignore,**/RCS,**/RCS/**,**/SCCS,**/SCCS/**,**/vssver.scc,**/.svn,**/.svn/**,**/.arch-ids,**/.arch-ids/**,**/.bzr,**/.bzr/**,**/.MySCMServerInfo,**/.DS_Store,**/.metadata,**/.metadata/**,**/.hg,**/.hg/**,**/.git,**/.git/**,**/BitKeeper,**/BitKeeper/**,**/ChangeSet,**/ChangeSet/**,**/_darcs,**/_darcs/**,**/.darcsrepo,**/.darcsrepo/**,**/-darcs-backup*,**/.darcs-temp-mail
[DEBUG] Max Mem: 64m
[WARNING] No files to instrument.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] CZ NGP Artifacts .................................. SUCCESS [0.952s]
[INFO] CZ Artifact: com.ofss.fc.junit.test ........ SUCCESS [46.850s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.098s
[INFO] Finished at: Tue May 22 19:17:18 IST 2012
[INFO] Final Memory: 31M/290M
pom.xml
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
why do you use cobertura:instrument goal?
in normal cases like yours you should use cobertura:cobertura goal. It will do instrumentation, tests run, and cobertura report. In your case you can call:
mvn cobertura:cobertura test

check http://mojo.codehaus.org/cobertura-maven-plugin/usage.html for usage details.
If you want that your Junit tests will be also included into coverage report do not exclude Test classes like it is done in the example provided on the link

Author

Commented:
I tried  mvn cobertura:cobertura  also...but still it looks for classes in /target/generated-classes/ folder ....where i don't have any source or classes.
All my compiled sources and test classes are got placed in target/cllasses (for java main source) or /target/test-classes/ folder(for test classes)  with respective to each child pom's target.

then how could i put java main source classes in generated-classes folder(i thought it should be automatically done by Maven).

i hv attached my child pom of test where coverage plugin is added.Please check i let me know ..whta is missing there...
Thanks for comment!
I think your pom.xml file is rather complicated. But anyway from it I see that it will call cobertura goals only when you will call site goal.
what happens if you call mvn clean install site ?

I would recommend to delete <execution>
  <id>clean</id>
  <phase>pre-site</phase>
- <goals>
  <goal>clean</goal>
  </goals>
  </execution>

as it actually will clean target directory before calling site goal.

Author

Commented:
i haave removed clean goal.
Don't work with mvn clean site command since i am not having site gole in pom.
If you see to do code coverage,cobertura pluging  requires.
Only missing part is somehow it is not getting files for instrumentation.(generated-classes folder has test classes  )

what is the base directory of instrumentation ?

Thanks !

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial