Can we create a container (a library) in Eclipse and add jars by Gradle task?

I created a JPMS Gradle project with Buildship in Eclipse that works very well with Gradle tasks.
But if I want to test my code directly, on the fly, without going through a test task, I get the error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.yaml.snakeyaml not found, required by DirectTest

This happens when launching the DirectTest.LibraryTest class that calls the testYaml () method of the DirectTest.Library class.
In the java command line expression, we see that the “-p” option does not contain the dependency on “org.yaml.snakeyaml”:

/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -p /Users/fbmac/tmp/DirectTest/build/classes/java/main -classpath /Users/fbmac/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.25/8b6e01ef661d8378ae6dd7b511a7f2a33fae1421/snakeyaml-1.25.jar:/Users/fbmac/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar:/Users/fbmac/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar --patch-module DirectTest=/Users/fbmac/tmp/DirectTest/build/resources/main:/Users/fbmac/tmp/DirectTest/build/classes/java/test:/Users/fbmac/tmp/DirectTest/build/resources/test:/Users/fbmac/tmp/DirectTest/bin/default --add-reads DirectTest=ALL-UNNAMED -m DirectTest/DirectTest.LibraryTest

However, if I manually add the library that is missing then the “-p” option is correctly filled and running the test code snippet is successful.

The problem is that when I refresh the Gradle project, the manually added library automatically disappears.
It is true that it is not a big constraint to add it after each refresh of Project Gradle as it is an infrequent operation.
But if someone knew the way to add a container and populate it with jars files in the Eclipse task (or any other means likely to get the expected result) it would be extra comfort.

It seems that the problem is that that the snakeyaml is only available on the classpath but not on the module path. Gradle (nor Buildship) has out-of-the-box support for that, but there are workarunds. You can mark a dependency as a module with the following snippet: