Gradle and Modules not working?

Answered

My newly created Gradle+Modules project is failing to build with

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':HelloApplication.main()'.
> Process 'command 'C:/Program Files/Java/jdk-13.0.2/bin/java.exe'' finished with non-zero exit value 1

and

> Task :HelloApplication.main() FAILED
Error occurred during initialization of boot layer
java.lang.module.FindException: Module validatorfx not found, required by com.group

Reproduce:
1. Create a new JavaFX project through the Wizard
2. Use Gradle instead of Maven
3. When it asks you for adding extra libraries, select validatorfx (it has not module-info.java)
4. Trying to run the newly created project ends with an error

It does work with Maven! Only the Gradle one fails for non-moduled libraries. What do I need to setup so that gradle sees validatorfx?

0
4 comments

All the tasks will use the classpath, not the modulepath, when executing. This obviously will cause issues when trying to create a modular.

 

skylight paycards

0

It is known issue: https://youtrack.jetbrains.com/issue/IDEA-273703

Please try if it helps to specify this dependency as

implementation('net.synedra:validatorfx:0.1.13') { exclude(group: 'org.openjfx') }

0

I suppose that, you're trying to use already unsupported library. You have to use URL connection or downgrade to sdk 22. If you need SDK version 23, then contract here

<a href="https://panoramacharter.vip/">panorama charter</a>

0

I noticed the file module-info.java:

...
requires validatorfx;
...

Which looks wrong to me, it should be:

...
requires net.synedra.validatorfx;
...

However the IDE doens't like this and it shows as RED!!!  autocomplete didn't like it too.

So I removed it, did a full rebuild and I also updated the version number of validatorfx to the latest build ( for me it was from 0.2.1 -> 0.3.1)

eg I changed the build.gradle file

implementation('net.synedra:validatorfx:0.2.1') { exclude(group: 'org.openjfx') }

After that, I put it back in module-info.java  and the auto complete fixed it to:

requires net.synedra.validatorfx;

All good :)

0

Please sign in to leave a comment.