我们拥有使用Azure DevOps构建的用Java编写的产品。面临的问题是SonarQube显示0.0%的代码覆盖率。 Azure DevOps发布代码覆盖任务能够拾取结果并将其显示在代码覆盖选项卡中,而不会出现任何问题。
这是正在使用的任务-
某些日志-
准备分析配置步骤-
##[debug]loading INPUT_SONAR.VERBOSE
##[debug]loading ENDPOINT_AUTH_5daf3e07-cbfb-436b-bc15-1d35da29eb90
##[debug]loading ENDPOINT_AUTH_SCHEME_5daf3e07-cbfb-436b-bc15-1d35da29eb90
##[debug]loading ENDPOINT_AUTH_PARAMETER_5daf3e07-cbfb-436b-bc15-1d35da29eb90_USERNAME
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_BLACKDUCK_VERSIONNAME
##[debug]loading SECRET_VSTSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 18
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SonarQube=5daf3e07-cbfb-436b-bc15-1d35da29eb90
##[debug]5daf3e07-cbfb-436b-bc15-1d35da29eb90=<redacted>
##[debug]5daf3e07-cbfb-436b-bc15-1d35da29eb90 auth param apitoken = null
##[debug]5daf3e07-cbfb-436b-bc15-1d35da29eb90 auth param username = ***
##[debug]5daf3e07-cbfb-436b-bc15-1d35da29eb90 auth param password = null
##[debug]organization=null
##[debug]scannerMode=Other
##[debug][SQ] API GET: '/api/server/version' with query "undefined"
##[debug]Response: 200 Body: "6.7.5.38563"
##[debug]extraProperties=sonar.projectKey=<redacted>
sonar.projectName=<redacted>
sonar.projectVersion=<redacted>
sonar.branch.name=sonarqube_fix
sonar.sourceEncoding=UTF-8
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=cobertura
sonar.cobertura.reportPath=coverage/cobertura/cobertura-coverage.xml
##[debug]set SONARQUBE_SCANNER_MODE=Other
##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_SCANNER_MODE;issecret=false;]Other
##[debug]set SONARQUBE_ENDPOINT=********
##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_ENDPOINT;issecret=true;]***
##[debug]set SONARQUBE_SCANNER_PARAMS={"sonar.host.url":"<redacted>","sonar.login":***,"sonar.projectKey":"<redacted","sonar.projectName":"<redacted>","sonar.projectVersion":"redacted","sonar.branch.name":"sonarqube_fix","sonar.sourceEncoding":"UTF-8","sonar.dynamicAnalysis":"reuseReports","sonar.java.coveragePlugin":"cobertura","sonar.cobertura.reportPath":"coverage/cobertura/cobertura-coverage.xml"}
##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_SCANNER_PARAMS;issecret=false;]{"sonar.host.url":"<redacted>","sonar.login":***,"sonar.projectKey":"<redacted>","sonar.projectName":"<redacted>","sonar.projectVersion":"<redacted>","sonar.branch.name":"sonarqube_fix","sonar.sourceEncoding":"UTF-8","sonar.dynamicAnalysis":"reuseReports","sonar.java.coveragePlugin":"cobertura","sonar.cobertura.reportPath":"coverage/cobertura/cobertura-coverage.xml"}
##[section]Finishing: Prepare analysis on SonarQube
没有单独的“运行分析”任务,因为这是Gradle任务。这是输出(已删除的不相关部分)
##[debug]Evaluating condition for step: 'gradlew build'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
##[section]Starting: gradlew build
==============================================================================
Task : Gradle
Description : Build using a Gradle wrapper script
Version : 2.151.0
Author : Microsoft Corporation
Help : https://go.microsoft.com/fwlink/?LinkID=613720
==============================================================================
##[debug]agent.TempDirectory=/vsts/agent/_work/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_WRAPPERSCRIPT
##[debug]loading INPUT_CWD
##[debug]loading INPUT_TASKS
##[debug]loading INPUT_PUBLISHJUNITRESULTS
##[debug]loading INPUT_TESTRESULTSFILES
##[debug]loading INPUT_CODECOVERAGETOOL
##[debug]loading INPUT_CLASSFILESDIRECTORIES
##[debug]loading INPUT_FAILIFCOVERAGEEMPTY
##[debug]loading INPUT_JAVAHOMESELECTION
##[debug]loading INPUT_JDKVERSION
##[debug]loading INPUT_JDKARCHITECTURE
##[debug]loading INPUT_GRADLEOPTS
##[debug]loading INPUT_SQANALYSISENABLED
##[debug]loading INPUT_SQGRADLEPLUGINVERSIONCHOICE
##[debug]loading INPUT_SQGRADLEPLUGINVERSION
##[debug]loading INPUT_CHECKSTYLEANALYSISENABLED
##[debug]loading INPUT_FINDBUGSANALYSISENABLED
##[debug]loading INPUT_PMDANALYSISENABLED
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SONARQUBE_ENDPOINT
##[debug]loading SECRET_BLACKDUCK_VERSIONNAME
##[debug]loading SECRET_VSTSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 25
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]check path : /vsts/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/task.json
##[debug]adding resource file: /vsts/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/task.json
##[debug]system.culture=en-US
##[debug]wrapperScript=/vsts/agent/_work/1/s/gradlew
##[debug]check path : /vsts/agent/_work/1/s/gradlew
##[debug]cwd=/vsts/agent/_work/1/s
##[debug]check path : /vsts/agent/_work/1/s
##[debug]javaHomeSelection=JDKVersion
##[debug]codeCoverageTool=None
##[debug]failIfCoverageEmpty=false
##[debug]publishJUnitResults=true
##[debug]testResultsFiles=/vsts/agent/_work/1/s/**/TEST-*.xml
##[debug]tasks=build
##[debug]System.DefaultWorkingDirectory=/vsts/agent/_work/1/s
##[debug]which '/vsts/agent/_work/1/s/gradlew'
##[debug]found: '/vsts/agent/_work/1/s/gradlew'
##[debug]which '/vsts/agent/_work/1/s/gradlew'
##[debug]found: '/vsts/agent/_work/1/s/gradlew'
##[debug]options=null
##[debug]/vsts/agent/_work/1/s/gradlew arg: ["build"]
##[debug]Using JDK version to find and set JAVA_HOME
##[debug]jdkVersion=default
##[debug]jdkArchitecture=x64
##[debug]Agent.Version=2.152.1
##[debug]Processed: ##vso[telemetry.publish area=TaskHub;feature=Gradle]{"jdkVersion":"default"}
##[debug]gradleOpts=-Xmx1024m
##[debug]GRADLE_OPTS is now set to -Xmx1024m
##[debug]Enabled code coverage successfully
##[debug]sqAnalysisEnabled=true
SonarQube analysis is enabled.
##[debug]sqGradlePluginVersionChoice=specify
##[debug]sqGradlePluginVersion=2.7.1
##[debug]/vsts/agent/_work/1/s/gradlew arg: ["-I","/vsts/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/node_modules/codeanalysis-common/sonar.gradle"]
##[debug]/vsts/agent/_work/1/s/gradlew arg: ["sonarqube"]
##[debug]System.DefaultWorkingDirectory=/vsts/agent/_work/1/s
##[debug]build.artifactStagingDirectory=/vsts/agent/_work/1/a
##[debug]build.buildNumber=20190607.4
##[debug]checkstyleAnalysisEnabled=false
##[debug]findbugsAnalysisEnabled=false
##[debug]pmdAnalysisEnabled=false
##[debug]Getting credentials for account feeds
SYSTEMVSSCONNECTION exists true
##[debug]SYSTEMVSSCONNECTION exists true
##[debug]Got auth token
##[debug]exec tool: /vsts/agent/_work/1/s/gradlew
##[debug]arguments:
##[debug] build
##[debug] -I
##[debug] /vsts/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/node_modules/codeanalysis-common/sonar.gradle
##[debug] sonarqube
[command]/vsts/agent/_work/1/s/gradlew build -I /vsts/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/node_modules/codeanalysis-common/sonar.gradle sonarqube
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Downloading https://services.gradle.org/distributions/gradle-4.8.1-bin.zip
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping /root/.gradle/wrapper/dists/gradle-4.8.1-bin/e8p42vx1m7a3mz9ydmjagn6wn/gradle-4.8.1-bin.zip to /root/.gradle/wrapper/dists/gradle-4.8.1-bin/e8p42vx1m7a3mz9ydmjagn6wn
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-4.8.1-bin/e8p42vx1m7a3mz9ydmjagn6wn/gradle-4.8.1/bin/gradle
Welcome to Gradle 4.8.1!
Here are the highlights of this release:
- Dependency locking
- Maven Publish and Ivy Publish plugins improved and marked stable
- Incremental annotation processing enhancements
- APIs to configure tasks at creation time
For more details see https://docs.gradle.org/4.8.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :processResources
> Task :classes
> Task :war
> Task :copyArtifacts
> Task :distZip
> Task :assemble
> Task :compileTestJava
> Task :processTestResources
> Task :testClasses
Note: /vsts/agent/_work/1/s/src/<redacted>ModuleQueriesTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :junitPlatformTest
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
2019-06-07 08:35:01,972 main ERROR Could not reconfigure JMX java.lang.LinkageError: loader constraint violation: loader (instance of org/powermock/core/classloader/MockClassLoader) previously initiated loading for a different type with name "javax/management/MBeanServer"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:250)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:194)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:71)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.logging.log4j.core.jmx.Server.unregisterAllMatching(Server.java:335)
at org.apache.logging.log4j.core.jmx.Server.unregisterLoggerContext(Server.java:259)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:164)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:556)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
at <redacted>.<clinit>(filename.java:92)
at sun.reflect.GeneratedSerializationConstructorAccessor102.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:45)
at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
at org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:14)
at org.powermock.api.mockito.repackaged.ClassImposterizer.createProxy(ClassImposterizer.java:144)
at org.powermock.api.mockito.repackaged.ClassImposterizer.imposterise(ClassImposterizer.java:59)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:122)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMock(MockCreator.java:70)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:47)
at org.powermock.api.mockito.PowerMockito.mock(PowerMockito.java:204)
at org.powermock.api.extension.listener.AnnotationEnabler.standardInject(AnnotationEnabler.java:118)
at org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:63)
at org.powermock.tests.utils.impl.PowerMockTestNotifierImpl.notifyBeforeTestMethod(PowerMockTestNotifierImpl.java:93)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:298)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:131)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.access$100(PowerMockJUnit47RunnerDelegateImpl.java:59)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner$TestExecutorStatement.evaluate(PowerMockJUnit47RunnerDelegateImpl.java:147)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.evaluateStatement(PowerMockJUnit47RunnerDelegateImpl.java:107)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:288)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:50)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:208)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:147)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:121)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:123)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:121)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:39)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:79)
at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:70)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
at org.junit.platform.console.tasks.ConsoleTestExecutor.executeTests(ConsoleTestExecutor.java:65)
at org.junit.platform.console.tasks.ConsoleTestExecutor.lambda$execute$0(ConsoleTestExecutor.java:57)
at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33)
at org.junit.platform.console.tasks.ConsoleTestExecutor.execute(ConsoleTestExecutor.java:57)
at org.junit.platform.console.ConsoleLauncher.executeTests(ConsoleLauncher.java:79)
at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:69)
at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:41)
╷
Test run finished after 11605 ms
[ 9 containers found ]
[ 0 containers skipped ]
[ 9 containers started ]
[ 0 containers aborted ]
[ 9 containers successful ]
[ 0 containers failed ]
[ 109 tests found ]
[ 0 tests skipped ]
[ 109 tests started ]
[ 0 tests aborted ]
[ 109 tests successful ]
[ 0 tests failed ]
> Task :test SKIPPED
> Task :check UP-TO-DATE
> Task :build
> Task :sonarqube
Property 'sonar.abap.file.suffixes' is not declared as multi-values/property set but was read using 'getStringArray' method. The SonarQube plugin declaring this property should be updated.
Unable to create a corresponding matcher for custom assertion method, please check the format of the following symbol: ''
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1m 55s
9 actionable tasks: 9 executed
<redacted irrelevant lines>
##[debug] /vsts/agent/_work/1/s/coverage/cobertura (directory)
##[debug] /vsts/agent/_work/1/s/coverage/cobertura/cobertura-coverage.xml (file)
##[debug] /vsts/agent/_work/1/s/node_modules/istanbul/lib/report/cobertura.js (file)
##[debug]14121 results
##[debug]found 14121 paths
##[debug]applying include pattern
##[debug]2 matches
##[debug]2 final results
##[debug]testRunTitle=null
##[debug]Reading test results from file '/vsts/agent/_work/1/s/build/test-results/junit-platform/TEST-junit-jupiter.xml'
No Result Found to Publish '/vsts/agent/_work/1/s/build/test-results/junit-platform/TEST-junit-jupiter.xml'.
##[debug]Reading test results from file '/vsts/agent/_work/1/s/build/test-results/junit-platform/TEST-junit-vintage.xml'
##[debug]Processed: ##vso[results.publish type=JUnit;mergeResults=true;publishRunAttachments=true;resultFiles=/vsts/agent/_work/1/s/build/test-results/junit-platform/TEST-junit-jupiter.xml,/vsts/agent/_work/1/s/build/test-results/junit-platform/TEST-junit-vintage.xml;testRunSystem=VSTS - gradle;]
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;]Build succeeded.
##[section]Async Command Start: Publish test results
Publishing test results to test run '1028438'
Test results remaining: 109. Test run id: 1028438
Published Test Run : <URL redacted>
##[section]Async Command End: Publish test results
##[section]Finishing: gradlew build
如何解决这个问题?