codacy / codacy-coverage-reporter

Multi-language coverage reporter for Codacy
https://www.codacy.com
Other
135 stars 94 forks source link

Java 10 Support #83

Closed davidgoate closed 6 years ago

davidgoate commented 6 years ago

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Linux 4.14.33-51.34.amzn1.x86_64 #1 x86_64 GNU/Linux

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

Oracle 10.0.1

Expected Behavior

Coverage is uploaded.

Actual Behavior

Error

+ java -jar /var/lib/jenkins/codacy-coverage-upload.jar report -l Java -r target/site/jacoco/jacoco.xml --project-token ****
05/17 12:19:03 INFO  c.c.rules.ConfigurationRules:101 - Using API base URL: https://api.codacy.com 
05/17 12:19:04 INFO  com.codacy.rules.ReportRules:126 - Commit UUID not provided, using latest commit of current directory:
51c7627635fd1a206497fdcd9ce0a1b6a9f98a4a Thu May 17 12:18:18 UTC 2018 
05/17 12:19:04 INFO  com.codacy.rules.ReportRules:48 - Parsing coverage data from: /var/lib/jenkins/workspace/develop/target/site/jacoco/jacoco.xml ... 
05/17 12:19:04 INFO  com.codacy.rules.ReportRules:81 - Generated report: /var/lib/jenkins/workspace/develop-TWQKWG6PRI3VSESCKN2SUW6A3XK226GXMW4GBFX5WTAVCECU3GRA/target/site/jacoco/codacy-coverage.json (0.15 kB) 
05/17 12:19:04 INFO  com.codacy.rules.ReportRules:82 - Uploading coverage data... 
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/MimetypesFileTypeMap
    at rapture.mime.MimeTypes$.<init>(mime.scala:1544)
    at rapture.mime.MimeTypes$.<clinit>(mime.scala)
    at rapture.net.PostType$$anon$14.contentType(net.scala:132)
    at rapture.net.PostType$$anon$14.contentType(net.scala:131)
    at rapture.net.HttpSupport$$anon$1$$anonfun$doHttp$1.apply(http.scala:159)
    at rapture.net.HttpSupport$$anon$1$$anonfun$doHttp$1.apply(http.scala:131)
    at rapture.core.ThrowExceptionsMode.wrap(modes.scala:199)
    at rapture.net.HttpSupport$$anon$1.doHttp(http.scala:131)
    at rapture.net.HttpSupport$Capability$$anonfun$httpPost$1.apply(http.scala:78)
    at rapture.net.HttpSupport$Capability$$anonfun$httpPost$1.apply(http.scala:78)
    at rapture.core.ThrowExceptionsMode.wrap(modes.scala:199)
    at rapture.net.HttpSupport$Capability.httpPost(http.scala:78)
    at com.codacy.api.client.CodacyClient.post(CodacyClient.scala:59)
    at com.codacy.api.service.CoverageServices.sendReport(CoverageServices.scala:21)
    at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1$$anonfun$apply$2.apply(ReportRules.scala:65)
    at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1$$anonfun$apply$2.apply(ReportRules.scala:50)
    at com.codacy.rules.ReportRules.com$codacy$rules$ReportRules$$transform(ReportRules.scala:99)
    at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1.apply(ReportRules.scala:50)
    at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1.apply(ReportRules.scala:50)
    at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:42)
    at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:40)
    at scala.Option.map(Option.scala:146)
    at com.codacy.parsers.CoverageParserFactory$.withCoverageReport(CoverageParser.scala:39)
    at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1.apply(ReportRules.scala:50)
    at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1.apply(ReportRules.scala:45)
    at cats.syntax.EitherOps$.flatMap$extension(either.scala:148)
    at com.codacy.rules.ReportRules.withCommitUUID(ReportRules.scala:131)
    at com.codacy.rules.ReportRules.coverageWithTokenAndCommit(ReportRules.scala:45)
    at com.codacy.rules.ReportRules.codacyCoverage(ReportRules.scala:35)
    at com.codacy.CodacyCoverageReporter$.run(CodacyCoverageReporter.scala:21)
    at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:13)
    at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:11)
    at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:97)
    at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:82)
    at scala.Option.foreach(Option.scala:257)
    at caseapp.CommandAppWithPreCommand.main(CommandAppWithPreCommand.scala:82)
    at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
Caused by: java.lang.ClassNotFoundException: javax.activation.MimetypesFileTypeMap
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 37 more
rtfpessoa commented 6 years ago

Hi @davidgoate, this library does not support Java 10 yet. Same as https://github.com/codacy/codacy-coverage-reporter/issues/76 I will open an internal ticket and see how we will progress. We still have no news but we should be able to start working on this in the next weeks.

davidgoate commented 6 years ago

I have a workaround, if i extract the stage I can set a different jdk tool:

stage('Upload Codacy Coverage') {
            tools {
                jdk 'JDK8'
            }
            environment {
                CODACY_CREDENTIAL_NAME = "${JOB_PREFIX}-codacy-token"
            }
            steps {
                echo 'Uploading code coverage to Codacy...'
                script {
                    echo "Using Credential Name: ${CODACY_CREDENTIAL_NAME}"
                    withCredentials([string(credentialsId: "${CODACY_CREDENTIAL_NAME}", variable: 'projectToken')]) {
                        sh 'java -jar /var/lib/jenkins/codacy-coverage-upload.jar report -l Java -r target/site/jacoco/jacoco.xml --project-token ${projectToken}'
                    }
                }
            }
        }
overheadhunter commented 6 years ago

In the meantime you might want to change the README.md, which falsely states:

Requirements Java JRE 8 and higher

igorstojanovski commented 6 years ago

Any progress on this? Need any help?

rtfpessoa commented 6 years ago

@igorstojanovski we have not been able to pick this up. In this case I think the solution would be to remove rapture and use circe or something similar for serialisation. Feel free to send a PR.

rtfpessoa commented 6 years ago

@davidgoate, @overheadhunter, @igorstojanovski as described in https://github.com/codacy/codacy-coverage-reporter/pull/89 we were able to do a quick hack to avoid the issue. Can you try it and see if it works.

Released as version 4.0.2.

igorstojanovski commented 6 years ago

@rtfpessoa works like a charm 👍 Thanks a lot!

overheadhunter commented 6 years ago

Can you try it and see if it works.

I can also confirm the fix. Runs on JDK 9 and JDK 10 CI systems as expected.