Skip to content

Gradle 7: test.moduleOptions.runOnClasspath doesn't work for test compilation #184

@shutyaev

Description

@shutyaev

In my project I get the following error for compileTestJava task:

error: package org.junit.jupiter.params is not visible
import org.junit.jupiter.params.ParameterizedTest;
                        ^
  (package org.junit.jupiter.params is declared in module org.junit.jupiter.params, but module org.foo does not read it)

although I've explicitly disabled modules for tests with:

test {
	useJUnitPlatform()
	moduleOptions {
		runOnClasspath = true
	}
}

and I've disabled the gradle 7 inferModulePath with

java {
	modularity.inferModulePath = false
}
tasks.withType(JavaCompile) {
	modularity.inferModulePath = false
}

Here's an isolated simple project demonstrating the behavior: https://github.com/shutyaev/gradle-7-test-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions