gpt4 book ai didi

selenium - 在 Jenkins 中通过 run.bat 文件运行我的 git 测试时在类路径异常中找不到类

转载 作者:行者123 更新时间:2023-11-28 20:26:37 24 4
gpt4 key购买 nike

我正在学习通过 Git 和 Jenkins 执行 eclipse 自动化代码。手动运行 bat 脚本时,它运行没有任何问题。但是,在通过 Git 运行它时,它会抛出 class not found in Classpath 异常。

错误日志

Building in workspace C:\Users\DELL\.jenkins\workspace\JenkinsGitTest
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/Satish152/GitTest.git # timeout=10
Fetching upstream changes from https://github.com/Satish152/GitTest.git
> git.exe --version # timeout=10
> git.exe fetch --tags --progress https://github.com/Satish152/GitTest.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 2e7f307474859cf6d5a4323cf210fbdd8a63200b (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f 2e7f307474859cf6d5a4323cf210fbdd8a63200b
Commit message: "changes made in class name"
> git.exe rev-list --no-walk fd6a75f2c57c49a45971fe35ec8b047910849b16 # timeout=10
[JenkinsGitTest] $ cmd /c call C:\Users\DELL\AppData\Local\Temp\jenkins1401414693910390241.bat

C:\Users\DELL\.jenkins\workspace\JenkinsGitTest>run.bat

C:\Users\DELL\.jenkins\workspace\JenkinsGitTest>set classpath=H:\workspace\GitHubTest\bin;H:\workspace\GitHubTest\lib\*;

C:\Users\DELL\.jenkins\workspace\JenkinsGitTest>java -cp bin;lib\* org.testng.TestNG testng.xml
[TestNG] [ERROR]
Cannot find class in classpath: gitTest.DemoGitTest
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

我在下面添加 Jenkins 项目配置截图:

Git project configuration in [![Git project configuration in jenkins1 Jenkins ] 2 ] 2

最佳答案

可能是你覆盖了 classpath 而它缺少分号 ;,试试这个

set classpath=H:\workspace\GitHubTest\bin;H:\workspace\GitHubTest\lib\*; 
java org.testng.TestNG testng.xml

或移除set classpath并执行

java -cp bin/*;lib/*; org.testng.TestNG testng.xml

关于selenium - 在 Jenkins 中通过 run.bat 文件运行我的 git 测试时在类路径异常中找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53832365/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com