openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
359 stars 62 forks source link

Gradle Test Executor log spam when used with JUnit 5 + Gradle 7.6 + Java 17 #141

Open louhy opened 1 year ago

louhy commented 1 year ago

Is it possible that this plugin is causing the following log spam when running tests, and can we turn it off?

When I comment out this plugin, these messages go away.

└─$ gradle clean build

> Configure project :
Project : => 'com.example.testmodule' Java module
18:57:26.834 [main] DEBUG org.gradle.process.internal.worker.child.ActionExecutionWorker - Starting Gradle Test Executor 67.
18:57:26.836 [Test worker] INFO org.gradle.api.internal.tasks.testing.worker.TestWorker - Gradle Test Executor 67 started executing tests.
18:57:26.971 [Test worker] INFO org.gradle.api.internal.tasks.testing.worker.TestWorker - Gradle Test Executor 67 finished executing tests.
18:57:26.972 [Test worker] DEBUG org.gradle.process.internal.worker.child.ActionExecutionWorker - Completed Gradle Test Executor 67.

> Task :test
18:57:26.782 [main] DEBUG org.gradle.internal.remote.internal.inet.TcpOutgoingConnector - Attempting to connect to [7eb4a7ff-45d1-4f64-9e6a-21c4f4f35263 port:33277, addresses:[/127.0.0.1]].
18:57:26.783 [main] DEBUG org.gradle.internal.remote.internal.inet.TcpOutgoingConnector - Trying to connect to address /127.0.0.1.
18:57:26.821 [main] DEBUG org.gradle.internal.remote.internal.inet.TcpOutgoingConnector - Connected to address /127.0.0.1:33277.

BUILD SUCCESSFUL in 1s
9 actionable tasks: 9 executed

This came from a "gradle clean build" of a modular Java 17 project with pretty much NOTHING in it but a single test and logback classic/JUnit5. Gradle version is 7.6 (both wrapper and installed to OS are 7.6 so it's definitely that version).

This is the build file:

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.13'  //Also tried older versions down to .10, same output
}

group 'com.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

sourceCompatibility = '17'
targetCompatibility = '17'

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

application {
    mainModule = 'com.example.testmodule'
    mainClass = 'com.example.testmodule.Example'
}

dependencies {
    //implementation 'org.slf4j:slf4j-api:1.7.36'
    //implementation 'ch.qos.logback:logback-core:1.2.11'
    implementation 'ch.qos.logback:logback-classic:1.2.11' //Comment this and it goes away

    testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
}

test {
    useJUnitPlatform()
}

Need at least one test:

package com.example.testmodule;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class ExampleTest {

    @Test
    void test() {
        Assertions.assertTrue(true);
    }
}

Main class is also nothing but an empty main() without even extending Application.

The log spam doesn't show up when the project is non-modular, just when module-info.java is present:

module com.example.testmodule {
    requires javafx.controls;
    requires javafx.fxml;
}

I tried eliminating pretty much everything to narrow down the cause and this is pretty much what I had left.

Edit: Just realized I think it's running with Azul's Zulu FX Java 17 JDK (thought it was just OpenJDK), but I'm not sure that would matter...