maven


Jacoco code coverage with Sonar and maven for integration tests in separate module


I've configured my project with SonarQube and Jacoco for code coverage. Everything works well except one thing. I divided project in many maven sub modules:
project (pom.xml) -
|-moduleA (no pom here)
| |- it (pom.xml) - integration tests for "impl" module
| |- impl (pom.xml) - implementaion + Unit tests
|-moduelB
| |- it (pom.xml) - integration tests for "impl" module
| |- impl (pom.xml) - implementaion + Unit tests
|-moduleC ...
I start build using following command:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent -Dmaven.compiler.debug=true install sonar:sonar
The problem is that Jacoco can easily support Unit test coverage inside the same module (so in my case Unit Tests inside impl module) but cannot analyze coverage from it module which itself does not contain any implementation classes. It just contains integration tests for impl module. It's clear for me why it doesn't work. I'm getting such info in Jacoco logs:
No JaCoCo analysis of project coverage can be done since there is no class files.
After I've defined sonar.java.binaries property inside moduleA/it/pom.xml like this:
<properties>
<sonar.java.binaries>../impl/target/classes</sonar.java.binaries>
</properties>
coverage analysis of it still fails, but message in Jacoco logs changes to:
[INFO] Analysing D:\project\moduleA\it\target\jacoco.exec
[WARNING] Coverage information was not collected. Perhaps you forget to include debug information into compiled classes?
I must mention that D:\project\moduleA\it\target\jacoco.exec file exists. I also checked that compiled classes in D:\project\moduleA\impl\target\classes contain debug data (all lines, vars and source).
I was trying with different paths inside sonar.java.binaries but result is always the same. I've tried:
../impl/target/classes
../../impl/target/classes
../../../impl/target/classes
../impl/target
...
How can I configure Jacoco (Sonar) to allow it to find classes binaries in different maven sub module related to jacoco.exec file?
How did you specify the location of the jacoco.exec files? This should give you a clue on what is the path start for the bin-files as well.
I am using both sonar.binaries as sonar.java.binaries
(Running sonar6.2)

Related Links

Maven Nested Multi-module project
mvn clean package, I want to copy the created jar to the current directory
Merging configuration values in Maven
In Maven 3 how can I use project.version for the module as a dependency to another project
jmeter plugin maven test-jar
i am getting “Missing artifact groupId:artifactId:version:lifecycle ” while compiling the project
Best way to auto compile compass-style SASS via maven
How to configure multi-module Maven + Sonar + JaCoCo to give merged coverage report?
maven determine default lifecycle phase for plugin
Multiple errors staging a release in Maven?
Maven project not built pom.xml error
Maven: Can i have resources copied in WEB-INF and also in some other directory?
Maven sonar plugin configurations for findbugs pmd checkstyle cobertura
Update site built by Tycho still contains erroneous dependency after re-build
How to run testNG tests using Maven POM file
publish an installation of hadoop in the local maven repository

Categories

HOME
maven
magnific-popup
activiti
iterator
office365api
vmware
xmpp
spring-cloud-stream
infragistics
electronics
alpha
fingerprint
virtualization
vifm
spring-kafka
numeral.js
gz
remote-access
fallback
windows-server-2012
msp430
decimal
foselasticabundle
samoa
riot.js
cloudhub
php-openssl
autosys
blazemeter
h2db
xpages-ssjs
qhull
status
chromebook
srcset
iframe-resizer
exuberant-ctags
ioio
code-contracts
hybridauth
repo
azure-sql-database
xmlreader
mapbox-gl
fusionpbx
devextreme
swisscomdev
space-complexity
neuroscience
leading-zero
mapzen
modelmapper
reactive-cocoa-5
taffy
clean-architecture
tizen-native-app
mako
imanage
yt-project
nested-sets
py2app
django-debug-toolbar
sigabrt
design-by-contract
unity-networking
python-3.2
fouc
varargs
sframe
0xdbe
ios9.1
interrupted-exception
sailfish-os
key-management
system.reflection
block-device
clicktag
dd
jscript.net
tt-news
angularjs-ng-click
file-copying
qcodo
websocket4net
googlemock
code-access-security
castle
responsive-slides
article
phpthumb
yorick
braille
resty-gwt
ruby-datamapper
dataservice
excel-2003
orchardcms-1.7
robotics-studio
chuck
viewswitcher
gwt-ext
doh
servicehost
android-sdk-2.1
castle-monorail
firefox-5
database-management
adrotator
thread-local-storage
zune
.net-1.0

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App