我需要为旧jar生成模块信息文件,该文件命名为: 使用以下命令的硒铬驱动程序-3.141.59.jar:
jdeps --module-path modules --generate-module-info out selenium-chrome-driver-3.141.59.jar
但我得到的结果是:
Missing dependence: C:...selenium.chrome.drivermodule-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
...
我尝试了这里和这里提到的:
jdeps --module-path modules --add-modules=ALL-MODULE-PATH --generate-module-info out selenium-chrome-driver-3.141.59.jar
然后我得到同样的错误。
作为替代方法,我尝试单独添加模块,例如:
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
我看到这个:
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)
无论我要添加哪个模块,问题将始终为:
java.lang.module.FindException name_of_your_module
使用更高的级别也没有帮助我:
jdeps --module-path modules --add-modules org.openqa.selenium --generate-module-info out selenium-chrome-driver-3.141.59.jar
错误将是:
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)
所以,我能做的最后一件事就是手动创建模块信息并使用exports
写入每个模块内部?
更新:
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
要通过 -cp 选项查找类:
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
我已经添加到selenium-chrome-driver-3.141.59.jar
,selenium-api-3.141.59.jar
也guava-25.0-jre.jar
和selenium-remote-driver-3.141.59.jar
。
文件selenium-chrome-driver-3.141.59.jar
不是模块化 JAR,因为它不包含任何模块信息,如module-info.class
文件。
对我来说,当我使用-cp
选项并添加依赖 JARS 时,jdeps
工作,就像这样......
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
我得到了这个输出...
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