Cannot run code coverage

bitbucket-server
plugin-sdk
clover

#1

I’m trying to get the test coverage of my plugin. Documentation clearly states that I should use command atlas-clover for that. But unfortunately it does not work at all.

atlas-clover runs old version of clover (3.1.7), which does not support java 8. I’ve figured that there is a new version of clover available and ran it manually the way that atlas-clover does:
$ /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1/bin/mvn -Djava.awt.headless=true com.atlassian.maven.plugins:clover-maven-plugin:4.1.2:setup verify com.atlassian.maven.plugins:clover-maven-plugin:4.1.2:clover com.atlassian.maven.plugins:clover-maven-plugin:4.1.2:log -gs /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1/conf/settings.xml -Dmaven.clover.jdk=1.8

It clover’s my plugin classes correctly, compiles everything, runs unit tests - everything good so far. But then it runs integration tests, and that fails. During installation of main plugin, it fails to import Spring components related to clover. There is a file target/testlibs/provided/clover-4.1.2.jar, so clover exists, but just fails to import. Error is like this:

[INFO] 2018-08-04 19:30:06,985 WARN [spring-startup] c.a.plugin.impl.AbstractPlugin Unable to enable plugin 'com.example.check_coverage'
...
[INFO] Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.example.check_coverage [129]: Unable to resolve 129.0: missing requirement [129.0] osgi.wiring.package; (osgi.wiring.package=com_atlassian_clover)

I’ve tried adding explicit spring component imports to pom.xml and/or adding clover as a dependency to the base plugin, but nothing works.

Linux, Ubuntu 18.04, reproduces on a fresh plugin (after atlas-create-bitbucket-plugin).

Output of atlas-version:

ATLAS Version: 6.3.10
ATLAS Home: /usr/share/atlassian-plugin-sdk-6.3.10
ATLAS Scripts: /usr/share/atlassian-plugin-sdk-6.3.10/bin
ATLAS Maven Home: /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1
AMPS Version: 6.3.15
--------
Executing: /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1/bin/mvn --version -gs /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1/conf/settings.xml
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T21:37:52+03:00)
Maven home: /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-29-generic", arch: "amd64", family: "unix"