Documentation of JUnit 5 tests in the Java plugin looks wrong


(Jean-Baptiste Nizet) #1

The documentation examples about JUnit 5 tests in the Java Plugin chapter of the user manual looks wrong to me. I quote:

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.3'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.0.3'
}

But, as far as I know, there is no testImplementation nor testRuntimeOnly configuration when using the Java plugin. These are not mentioned in this very same guide, anyway. As far as I know, these configurations are introduced by the Java Library plugin, not by the Java plugin.

So this makes things quite confusing, IMHO.


(Stefan Oehme) #2

Both these configurations exist, only the api configuration is specific to the java-library plugin. We will improve the rest of the Java plugin user guide soon.


(Jean-Baptiste Nizet) #3

OK, thanks Stefan.

The Java library plugin documentation should be fixed too, then. For example, this section tells that white configurations are inherited from the java plugin, and only compileOnly and testCompileOnly are in white.

It also says:

The plugin exposes two configurations that can be used to declare dependencies: api and implementation

although implementation apparently comes from the Java plugin.


(Eric Wendelin) #4

Thanks for the info. I’ve marked it as something to fix in our docs soon.

Cheers,
Eric