Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong directory lookup for Java test classes #92

Open
bjurkovski opened this issue Mar 14, 2019 · 2 comments
Open

Wrong directory lookup for Java test classes #92

bjurkovski opened this issue Mar 14, 2019 · 2 comments

Comments

@bjurkovski
Copy link

I have a build.gradle.kts looking roughly like this:

import org.scoverage.OverallCheckTask
import com.google.protobuf.gradle.ExecutableLocator
import com.google.protobuf.gradle.ProtobufConfigurator

plugins {
  java
  scala
  id("com.google.protobuf") version "0.8.5"
}

dependencies {
    // My dependencies ...
}

val jar by tasks
jar.dependsOn("generateTestProto")


protobuf {
  protobuf(closureOf<ProtobufConfigurator> {
    // Configure location of the proto compiler
    protoc(closureOf<ExecutableLocator> {
      artifact = thirdParty.protoc
    })
  })
}

If I try to run ./gradlew :my-module:checkSCoverage, it'll fail to find the generated proto classes as tries to look for them in build/classes/java/testScoverage instead of build/classes/java/test.

@eyalroth
Copy link
Contributor

Scoverage does not cover Java sources, only Scala. For Java, there are multiple coverage tools. You can check my example project here to see how to use both Scoverage and Cobertura in the same build.

@pan3793
Copy link

pan3793 commented Jun 29, 2022

Hi, I encounter the same issue, I think it's caused by scoverage does not pick up the protoc generated source files, any suggestions?

To reproduce the error, clone https://github.com/housepower/spark-clickhouse-connector and run ./gradlew clean test reportTestScoverage

➜  spark-clickhouse-connector git:(master) ./gradlew clean test reportTestScoverage

> Task :clickhouse-core:compileScoverageJava
Execution optimizations have been disabled for task ':clickhouse-core:compileScoverageJava' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/build/generated-src/antlr/main'. Reason: Task ':clickhouse-core:compileScoverageJava' uses this output of task ':clickhouse-core:generateGrammarSource' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :clickhouse-core:compileScoverageScala FAILED
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/exception/ClickHouseException.scala:18:14: object protocol is not a member of package xenon
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/exception/ClickHouseException.scala:26:23: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/exception/ClickHouseException.scala:36:23: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:34:14: object protocol is not a member of package xenon
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:33:14: object protocol is not a member of package xenon
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:48:26: not found: value ClickHouseGrpc
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:49:5: not found: value ClickHouseGrpc
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:53:36: not found: value QueryInfo
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:90:13: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:158:13: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:106:13: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:138:13: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:142:19: not found: value QueryInfo
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:183:13: not found: type GRPCException
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:181:14: not found: type QueryInfo
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:161:21: not found: value QueryInfo
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:187:20: not found: type Result
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:188:20: not found: type Result
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:214:21: not found: value QueryInfo
[Error] /Users/chengpan/Projects/spark-clickhouse-connector/clickhouse-core/src/main/scala/xenon/clickhouse/grpc/GrpcNodeClient.scala:243:31: not found: type Result
20 errors found

FAILURE: Build failed with an exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants