简体   繁体   English

Ant在其创建的.jar文件中找不到类

[英]Ant cannot find class in .jar file that it made

I get the following error when running a build from jenkins: I have narrowed it down to ant or the environment not being able to find my BrowserLaunch.class file, "no logs are coming from that file", thus it says there is nosuchmethod. 从jenkins运行构建时,出现以下错误:我将其范围缩小到了ant或环境无法找到我的BrowserLaunch.class文件,“该文件无日志”,因此它说没有这种方法。 However, I have no idea why! 但是,我不知道为什么! I have these tests working on a different environment using Eclipse, but not with Ant + Jenkins + TestNG + Java. 我使用Eclipse在不同的环境下进行了这些测试,但没有使用Ant + Jenkins + TestNG + Java。 Any idea's ? 有任何想法吗 ? I have a selenium grid running on a different VM than the jenkins build server, and they can ping... The remote webdriver code points to the grid hub . 我有一个运行在与jenkins构建服务器不同的VM上的硒网格,并且它们可以ping ...远程Webdriver代码指向Grid Hub。 I think it may be permissions, but all class files have the same rw access. 我认为这可能是权限,但是所有类文件都具有相同的rw访问权限。 All the necessary classes are in the .jar I build from ANT. 所有必需的类都在我从ANT构建的.jar中。

AILED CONFIGURATION: @BeforeTest beforeTest(org.testng.TestRunner@108c35f3)
   [testng] java.lang.NoSuchMethodError:genericscripts.driverscripts.BrowserLaunch.createDriver(Ljava/lang/String;)Lorg/openqa/selenium/WebDriver;
   [testng]     tests.ManagementTests.beforeTest(Unknown Source)
   [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [testng]     at              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [testng]     at java.lang.reflect.Method.invoke(Method.java:601)
   [testng]     at   org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
   [testng]     at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
   [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
   [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)
   [testng]     at org.testng.TestRunner.beforeRun(TestRunner.java:624)
   [testng]     at org.testng.TestRunner.run(TestRunner.java:592)
   [testng]     at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
   [testng]     at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
   [testng]     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
   [testng]     at org.testng.SuiteRunner.run(SuiteRunner.java:223)
   [testng]     at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
   [testng]     at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
   [testng]     at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
   [testng]     at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
   [testng]     at org.testng.TestNG.run(TestNG.java:900)
   [testng]     at org.testng.TestNG.privateMain(TestNG.java:1182)
   [testng]     at org.testng.TestNG.main(TestNG.java:1146)
   [testng] 
   [testng] SKIPPED: createTenanttests(org.testng.TestRunner@108c35f3)
   [testng] 
   [testng] ===============================================
   [testng]     Test
   [testng]     Tests run: 1, Failures: 0, Skips: 1
   [testng]     Configuration Failures: 1, Skips: 0
   [testng] ===============================================

I had duplicate classes on the file system, and the ant build file was picking up the old one, instead of the new. 我在文件系统上有重复的类,而ant构建文件正在拾取旧版本,而不是新版本。 Once that was deleted, I got past that error, 删除后,我克服了这个错误,

In fact ant found class but didn't match the method. 实际上,ant找到了类,但没有匹配该方法。

Make sure there isn't more than one version of BrowserLaunch.class in your project. 确保项目中没有多个版本的BrowserLaunch.class。

There must be a difference between the classes you provide for the compilation of tests.ManagementTests.beforeTest and the classes you provide for the runtime of the tests. 您为tests.ManagementTests.beforeTest的编译提供的类与为测试的运行时提供的类之间必须存在差异。 It's hard to say more not seeing these 2 targets. 很难说没有看到这两个目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM