1

I need to generate module-info file for legacy jar which named as: selenium-chrome-driver-3.141.59.jar using the command:

jdeps --module-path modules --generate-module-info out selenium-chrome-driver-3.141.59.jar

But I'm getting as result:

Missing dependence: C:\...\selenium.chrome.driver\module-info.java not generated
Error: missing dependencies
   org.openqa.selenium.chrome.ChromeDriver            -> com.google.common.collect.ImmutableMap             not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.Capabilities                   not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.WebDriverException             not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.html5.LocalStorage             not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.html5.Location                 not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.html5.LocationContext          not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.html5.SessionStorage           not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.html5.WebStorage               not found
   org.openqa.selenium.chrome.ChromeDriver            -> org.openqa.selenium.interactions.HasTouchScreen    not found
...

I tried as mentioned here and here:

jdeps --module-path modules --add-modules=ALL-MODULE-PATH --generate-module-info out selenium-chrome-driver-3.141.59.jar

Then I'm getting the same error.

As alternative way, I tried to add separately modules like:

jdeps --module-path modules --add-modules  org.openqa.selenium.chrome,org.openqa.selenium.remote --generate-module-info out selenium-chrome-driver-3.141.59.jar

And I see this:

Exception in thread "main" java.lang.module.FindException: Module org.openqa.selenium.chrome not found
        at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
        at java.base/java.lang.module.Resolver.resolve(Resolver.java:128)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:411)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:245)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration.<init>(JdepsConfiguration.java:117)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:563)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:589)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:543)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:519)
        at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)

And no matter which module I'll add, the issue will be always as:

java.lang.module.FindException name_of_your_module

Using one level higher didn't help me also:

jdeps --module-path modules --add-modules  org.openqa.selenium --generate-module-info out selenium-chrome-driver-3.141.59.jar

The error will be:

Exception in thread "main" java.lang.module.FindException: Module org.openqa.selenium not found
        at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
        at java.base/java.lang.module.Resolver.resolve(Resolver.java:128)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:411)

So, the last thing that I can do is to create module-info manually and write inside each module using exports?

Updated:

jdeps -cp guava-25.0-jre.jar;selenium-api-3.141.59.jar;selenium-remote-driver-3.141.59.jar selenium-chrome-driver-3.141.59.jar

To find classes via -cp option:

selenium-chrome-driver-3.141.59.jar -> guava-25.0-jre.jar
selenium-chrome-driver-3.141.59.jar -> java.base
selenium-chrome-driver-3.141.59.jar -> selenium-api-3.141.59.jar
selenium-chrome-driver-3.141.59.jar -> selenium-remote-driver-3.141.59.jar

I have added to selenium-chrome-driver-3.141.59.jar, selenium-api-3.141.59.jar also guava-25.0-jre.jar and selenium-remote-driver-3.141.59.jar.

invzbl3
  • 5,872
  • 9
  • 36
  • 76
  • Your `jdeps` command includes the option `--module-path modules` - for this to work, there needs to be a folder `modules` in the directory where you execute the command that contains all dependencies of the Selenium Chrome driver. Is that the case? – Nicolai Parlog Nov 25 '19 at 07:14
  • @Nicolai, E.g. I have selenium jar file inside: `C:\Users\invzbl3\Desktop\modules`.I'm using the command `jdeps --module-path modules --generate-module-info out selenium-chrome-driver-3.141.59.jar` there. And also `Error: missing dependencies`. What's interesting it happens exactly for `selenium-chrome-driver-3.141.59.jar` file, if I do the same actions for `selenium-api-3.141.59.jar` it works good. I don't understand what is the difference. – invzbl3 Dec 05 '19 at 20:11

1 Answers1

1

File selenium-chrome-driver-3.141.59.jar is not a modular JAR since it does not contain any module info like a module-info.class file.

For me, jdeps worked when I used the -cp option and added the dependent JARS, like so...

jdeps -cp guava-25.0-jre.jar;selenium-api-3.141.59.jar;selenium-remote-driver-3.141.59.jar selenium-chrome-driver-3.141.59.jar

And I got this output...

selenium-chrome-driver-3.141.59.jar -> guava-25.0-jre.jar
selenium-chrome-driver-3.141.59.jar -> java.base
selenium-chrome-driver-3.141.59.jar -> selenium-api-3.141.59.jar
selenium-chrome-driver-3.141.59.jar -> selenium-remote-driver-3.141.59.jar
   org.openqa.selenium.chrome                         -> com.google.common.base                             guava-25.0-jre.jar
   org.openqa.selenium.chrome                         -> com.google.common.collect                          guava-25.0-jre.jar
   org.openqa.selenium.chrome                         -> com.google.common.io                               guava-25.0-jre.jar
   org.openqa.selenium.chrome                         -> java.io                                            java.base
   org.openqa.selenium.chrome                         -> java.lang                                          java.base
   org.openqa.selenium.chrome                         -> java.lang.invoke                                   java.base
   org.openqa.selenium.chrome                         -> java.util                                          java.base
   org.openqa.selenium.chrome                         -> java.util.function                                 java.base
   org.openqa.selenium.chrome                         -> java.util.stream                                   java.base
   org.openqa.selenium.chrome                         -> org.openqa.selenium                                selenium-api-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.html5                          selenium-api-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.interactions                   selenium-api-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.mobile                         selenium-api-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.remote                         selenium-remote-driver-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.remote.html5                   selenium-remote-driver-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.remote.http                    selenium-remote-driver-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.remote.mobile                  selenium-remote-driver-3.141.59.jar
   org.openqa.selenium.chrome                         -> org.openqa.selenium.remote.service                 selenium-remote-driver-3.141.59.jar
Abra
  • 19,142
  • 7
  • 29
  • 41
  • Thanks for the answer Abra. I know that this is not modular JAR, so I'm trying to generate for this jar module-info file to use it in Java 11 project. But all commands don't work for me in this way. if -cp option is for finding classes then how it helps to get module-info file? Because I have: `-classpath cannot be used with --generate-module-info option`. – invzbl3 Aug 15 '19 at 13:48