java - Jenkins - Java CLASSPATH 未正确加载
问题描述
我正在尝试在 jenkins 代理中运行 selenium java 类。
但是 CLASSPATH 对于 java 程序没有按预期工作。jar 文件在selenium/target/classes
目录内。它可以在我的 Windows 桌面上运行,但不能在服务器上运行。
org/openqa/selenium/chrome/ChromeOptions
问题已selenium-chrome-driver-2.26.0.jar
在 Windows 中解决。但它没有在linux环境中加载。
任何建议都会有所帮助。
environment {
CLASSPATH = ".:google-collections-1.0.jar:selenium-chrome-driver-2.26.0.jar:selenium-server-standalone-3.13.0.jar"
}
steps {
dir("selenium/target/classes") {
sh 'echo "Selenium test"'
catchError {
sh 'java demo.selenium.IBanTest'
}
}
}
错误:
+ java demo.selenium.IBanTest
iBan Selenium Testing
Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.chrome.ChromeOptions.addArguments([Ljava/lang/String;)Lorg/openqa/selenium/chrome/ChromeOptions;
at demo.selenium.IBanTest.setup(IBanTest.java:34)
at demo.selenium.IBanTest.main(IBanTest.java:22)
解决方案
推荐阅读
- c# - 如何强制我的超网格乐队可扩展
- java - 无法在 Eclipise 中运行 Spring Boot + JavaFX
- gurobi - 如何处理 Gurobi 约束中的绝对值
- vb.net - 填充网页文本框并通过 vb.net 中的 Web 浏览器控件自动提交
- java - CreatePlatformSocket() failed: Operation not allowed (1) during facebook login Android
- python - 理解python for循环语句中的变量声明
- python - ImportError:符号 __res_maybe_init 版本 GLIBC_PRIVATE 未在带有链接时间参考的文件 libc.so.6 中定义
- python - 使用 pyModbus 库中的 diag_message 函数时出现解码错误
- java - 扩大数字范围
- python - 比较 Pandas 中的相对开始日期