I'm getting a Kotlin error on the test build that ...
# tornadofx
a
I'm getting a Kotlin error on the test build that says
Module java.base cannot be found in the module graph
, which I thought might have been a bytecode issue
a
it's probably because incorrect JavaFX library installation (I think I've got something like this at my first attempts to run Kotlin+OracleJDK+JavaFX), or did you make any modification in my example?
a
I'll checkout any changes, clean it and run the build again
Okay, it's clean, I don't know if it might be the configuration or the project dependcies
Alright, well - since it says that it cannot access SampleTest in sample.project, I'll just start with that
In any case, I think what I may have indicated earlier is confirmed by non-interference specs here: http://openjdk.java.net/projects/jigsaw/spec/reqs/
Copy code
Non-interference — The Java compiler, virtual machine, and run-time system must ensure that modules that contain packages of the same name do not interfere with each other. If two distinct modules contain packages of the same name then, from the perspective of each module, all of the types and members in that package are defined only by that module. Code in that package in one module must not be able to access package-private types or members in that package in the other module.
@alex I don't know if you need to place your Test code in a module
I moved your TestClass in the test package itself, which removed the errors - but I'm still getting the Kotlin compilation issues
I'll see if I can get that fixed so I can share what I mean
It is common to place the code you intend for your tests simply in the Testing module itself. A good example of this is to check out some of the tests in TornadoFX source code: https://github.com/edvin/tornadofx/tree/master/src/test/kotlin/tornadofx
^here, you'll see that the code made as demos for tests are placed in the
testapps
folder
a
right, and I was confused about this approach too
because of the error in IDE I mentioned earlier
but it seems like IDE issue
and you can't test internals of other modules (i.e. if your project is highly modular), i.e. whitebox testing is limited
a
bummer 🤦‍♀️ okay. I have to get rid of this Kotlin error first then and run it to see what you mean
@alex could be - ugh nothing is more painful than set ups
a
Yeah, it was very confusing at the beginning
a
Okay, I hope you don't mind me backing up - I want to make sure I have your assumptions correct
I'll keep the part I have messed with but I'll have another clean version from your file
a
Basically I did: 1. Install JDK11 2. Unpack JavaFX SDK anywhere 3. Create global library and point it to JavaFX 4. Create Kotlin project, set project SDK to JDK11, and add JavaFX module to project module on dependency page.
a
The one from here, right? https://jdk.java.net/11/
a
JDK11 from Oracle web site, JavaFX SDK from https://openjfx.io/
a
thanks! Got it installed and this is what the maven compilation got me from the command line -
Copy code
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project project: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java are missing or invalid -> [Help 1]
a
seems like I forgot to correct this property, you can either comment whole execution or point to your main class in package
a
Thanks for being patient with me I wanna make sure I have the exact environment you have so I'm not changing the fundamental structure of your project 😄
@alex what package are you referring to?
@alex also, is there a reason why dependencies are being wrapped in DependencyManagement in relating to scoping? It is normally fine without that wrapper
a
app
? I've checked the second archive, seems like I've deleted unnecessary
main.class
property and execution plugin, or are you testing the first archive? DependencyManagement is present because it's just trimmed version of my project, I copy-pasted some parts
a
@alex the second one!
a
But there is no main class property? I'll check within an hour when I'll get home
a
this is probably on me. Let me find that second one you sent bc when I said I wanted to download a clean version I may have downloaded the first one again