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

Cannot compile/run with the new 'configurations' property #149

Open
palexdev opened this issue May 22, 2023 · 6 comments
Open

Cannot compile/run with the new 'configurations' property #149

palexdev opened this issue May 22, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@palexdev
Copy link

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:
image

If I use:
configurations = [ 'compileOnly', 'testImplementation' ]
I can compile, no more errors in the IDE, but when I run the application:
image

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?

@abhinayagarwal abhinayagarwal added the bug Something isn't working label May 23, 2023
@abhinayagarwal
Copy link
Collaborator

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.

@palexdev
Copy link
Author

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:
image

Running ./gradlew dependecies though, seems to reveal that the JavaFX modules have not been added to implementation

  • This is the report with implementation: Gradle Scan
  • This is the report with compileOnly and runtimeOnly: Gradle Scan

To make things even more weird, the fact that JavaFX modules are correctly added for the test environment, lol what's going on haha

@abhinayagarwal
Copy link
Collaborator

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)

...

@TheBoegl
Copy link

We ran into the same issue as @palexdev with gradle 7.6.1 and 8.1.1. Adding compileOnly to the configurations fixes this.

@abhinayagarwal
Copy link
Collaborator

It would be nice to have a test project where the behavior can be reproduced.

@TheBoegl
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants