Open palexdev opened 1 year ago
Yes, implementation
cover both compile and runtime dependencies.
I am unable to reproduce the issue you are facing with configurations = [ 'implementation', 'testImplementation' ]
.
Have you tried compiling via the terminal?
This looks like an IDE cache issue.
Yes,
implementation
cover both compile and runtime dependencies.I am unable to reproduce the issue you are facing with
configurations = [ 'implementation', 'testImplementation' ]
.Have you tried compiling via the terminal?
This looks like an IDE cache issue.
Unfortunately I have the same issue if I use the Gradle Wrapper:
Running ./gradlew dependecies
though, seems to reveal that the JavaFX modules have not been added to implementation
implementation
: Gradle Scan
compileOnly
and runtimeOnly
: Gradle ScanTo make things even more weird, the fact that JavaFX modules are correctly added for the test environment, lol what's going on haha
I don't see an issue with the following configurations:
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.14'
}
repositories {
mavenCentral()
}
javafx {
version = '17'
modules = [ 'javafx.controls' ]
configurations = [ 'implementation', 'testImplementation' ]
}
mainClassName = 'HelloFX'
Running ./gradlew -q dependencies
gives the following o/p:
➜ hellofx git:(master) ✗ ./gradlew -q dependencies
------------------------------------------------------------
Root project 'hellofx'
------------------------------------------------------------
annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies
apiElements - API elements for main. (n)
No dependencies
archives - Configuration for archive artifacts. (n)
No dependencies
compileClasspath - Compile classpath for source set 'main'.
+--- org.openjfx:javafx-base:17
+--- org.openjfx:javafx-graphics:17
| \--- org.openjfx:javafx-base:17
\--- org.openjfx:javafx-controls:17
\--- org.openjfx:javafx-graphics:17 (*)
compileOnly - Compile only dependencies for source set 'main'. (n)
No dependencies
default - Configuration for default artifacts. (n)
No dependencies
implementation - Implementation only dependencies for source set 'main'. (n)
+--- org.openjfx:javafx-base:17 (n)
+--- org.openjfx:javafx-graphics:17 (n)
\--- org.openjfx:javafx-controls:17 (n)
...
We ran into the same issue as @palexdev with gradle 7.6.1 and 8.1.1. Adding compileOnly
to the configurations
fixes this.
It would be nice to have a test project where the behavior can be reproduced.
It's as simple as modifying your example and use the java-library instead of the application plugin:
plugins {
id 'java-library'
id 'org.openjfx.javafxplugin' version '0.0.14'
}
repositories {
mavenCentral()
}
javafx {
version = '17'
modules = [ 'javafx.controls' ]
configurations = [ 'implementation', 'testImplementation' ]
}
Running ./gradlew -q dependencies
shows that only the the testImplementation and therefore testCompileClasspath and testRuntimeClasspath are set as expected.
Hey @abhinayagarwal, I finally had some time to test the plugin with the recent changes. Seems like there are still issues.
If I use the configuration shown here in the README:
configurations = [ 'implementation', 'testImplementation' ]
I have this situation:If I use:
configurations = [ 'compileOnly', 'testImplementation' ]
I can compile, no more errors in the IDE, but when I run the application:The only configuration that allows me to compile and run is:
configurations = [ 'compileOnly', 'runtimeOnly', 'testImplementation' ]
However, shouldn't
implementation
cover both of them? Am I doing something wrong?