Compilation error with Clover enabled - missing type, cannot find symbol


アトラシアン コミュニティをご利用ください。



When Clover is enabled compilation fails with a missing type error, for example:

[javac] /workspace/com/samples/ cannot find symbol
[javac] symbol  : variable BuildTime
[javac] location: class com.samples.OtherClass
[javac]                                                              ^
[javac] 1 error



Errors related with a missing symbol might occur when:

  • you have source code generation integrated with your build process and
  • sources are being generated after Clover's instrumentation


For example, if you have a Maven-based build and you use maven-antrun-plugin or maven-exec-plugin to generate source files:


         <copy file="${}/com/samples/"
               tofile="${}/com/samples/" overwrite="true"/>


and you run standard Clover instrumentation, such as:

mvn clean clover:setup test clover:clover clover:aggregate


Clover's code instrumentation (clover:setup) will occur before code generation (as the 'generate-sources' phase will be triggered by the 'test' phase). Clover will also change source roots (e.g. from 'src/main/java' to 'target/clover/src-instrumented'). As a consequence, the file will be written to an old source root ('src/main/java') and will not be compiled at all.



Please verify if your build process contains any code/resource generation. If it does, make sure that

  • Clover is initialized and sources are instrumented after all files are have already been generated
  • or ensure that generated sources will be copied to folder(s) containing instrumented files.


You can either do it in a command line:


mvn clean generate-sources clover:setup test


or you can bind the 'clover:setup' to a build phase which happens after the 'generate-sources' one:


最終更新日: 2015 年 12 月 8 日


Powered by Confluence and Scroll Viewport.