Maven Surefire无法在Jenkins上实例化我的IReporter类

时间:2017-02-13 18:12:25

标签: java maven jenkins testng maven-surefire-plugin

由于无法实例化我的TestNG IReporter类CustomReportListener.java(CRL),我有一个无法运行的Jenkins项目。如果我删除对它的所有引用,项目运行正常,但我需要通过CRL返回结果。最后,CRL是我们作为JAR包含的框架的一部分,并且测试在使用JAR中的任何其他类似乎没有问题。

主要错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project fordna: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR] 
[ERROR] Cannot instantiate class com.perficient.util.result.CustomReportListener
[ERROR] at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:53)
[ERROR] at org.testng.TestNG.initializeConfiguration(TestNG.java:981)
[ERROR] at org.testng.TestNG.run(TestNG.java:1089)
[ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] Caused by: java.lang.ExceptionInInitializerError
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[ERROR] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[ERROR] at java.lang.Class.newInstance(Class.java:442)
[ERROR] at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:51)
[ERROR] ... 8 more
[ERROR] Caused by: java.lang.NullPointerException
[ERROR] at sun.awt.shell.Win32ShellFolder2.access$200(Win32ShellFolder2.java:72)
[ERROR] at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:242)
[ERROR] at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:237)
[ERROR] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[ERROR] at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:547)
[ERROR] at java.lang.Thread.run(Thread.java:745)
[ERROR] -> [Help 1]

我尝试了很多方法,包括在Jenkins上运行它作为自由式作业,并尝试以下Surefire设置,通常是逐个:

  • <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-testng</artifactId> <version>2.19.1</version>
  • <useManifestOnlyJar>false</useManifestOnlyJar>
  • <useSystemClassLoader>false</useSystemClassLoader>
  • <reuseForks>false</reuseForks>
  • <forkCount>0</forkCount>

完整(标准)构建结果:

Building in workspace C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2
Updating https://subversion.thecompany.com/svn/automation-test-center/trunk/FunctionalAutomation/ExampleProject at revision '2017-02-13T11:22:42.215 -0500'
A         target\log4j2.xml
U         pom.xml
At revision 3271

Parsing POMs
Modules changed, recalculating dependency graph
Established TCP socket on 56149
[workspace@2] $ "C:\Program Files\Java\jdk1.8.0_121/bin/java" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5001 -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-1.8.1.jar;C:\Maven3.3.9\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Maven3.3.9\apache-maven-3.3.9/conf/logging" jenkins.maven3.agent.Maven33Main C:\Maven3.3.9\apache-maven-3.3.9 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-3.4.1.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-1.8.1.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.8.1.jar" 56149
Listening for transport dt_socket at address: 5001
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\pom.xml clean test -e -DsuiteFile=src/main/test/suites/ca/alpha/desktop/QA_FOC_Brochures_Alpha.xml -Drunvehicle=All Models
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.thecompany.automation:example-project:jar:2.0.0-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.thecompany.automation:automation-util:jar should not point at files within the project directory, ${basedir}/src/resources/lib/automation-util-1.18.1.jar will be unresolvable by dependent projects @ line 104, column 16
[WARNING] 'dependencies.dependency.systemPath' for com.gamma.servicesapi:servicesapi:jar should not point at files within the project directory, ${basedir}/src/resources/lib/ServicesClientLibrary-1.2.112.jar will be unresolvable by dependent projects @ line 111, column 16
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building ExampleProject 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ example-project ---
[INFO] Deleting C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\target
[INFO] 
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (add-source) @ example-project ---
[INFO] Source directory: C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\src\main\objects added.
[INFO] Source directory: C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\src\main\test\classes added.
[INFO] Source directory: C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\src\main\test\suites added.
[INFO] 
[INFO] --- build-helper-maven-plugin:3.0.0:add-resource (add-resource) @ example-project ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ example-project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\src\main\resources
[INFO] Copying 19 resources to resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ example-project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 212 source files to C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\target\classes
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_FOC_Brochures_Alpha/workspace@2/src/main/objects/com/alpha/global/Leads.java: Some input files use or override a deprecated API.
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_FOC_Brochures_Alpha/workspace@2/src/main/objects/com/alpha/global/Leads.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_FOC_Brochures_Alpha/workspace@2/src/main/test/classes/com/alpha/global/TC_GUX_BNP.java: C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\src\main\test\classes\com\alpha\global\TC_GUX_BNP.java uses unchecked or unsafe operations.
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_FOC_Brochures_Alpha/workspace@2/src/main/test/classes/com/alpha/global/TC_GUX_BNP.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ example-project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ example-project ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ example-project ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\test-output
Running TestSuite
Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[JENKINS] Recording test results
hudson.AbortException: Test reports were found but none of them are new. Did tests run? 
For example, C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\test-output\TEST-TestSuite.xml is 1 hr 51 min old

    at hudson.tasks.junit.TestResult.parse(TestResult.java:228)
    at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:148)
    at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:623)
    at hudson.maven.Maven3Builder$MavenExecutionListener.mojoFailed(Maven3Builder.java:656)
    at hudson.maven.Maven3Builder$JenkinsEventSpy.onEvent(Maven3Builder.java:300)
    at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104)
    at org.apache.maven.eventspy.internal.EventSpyExecutionListener.mojoFailed(EventSpyExecutionListener.java:138)
    at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:90)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:219)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:133)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
    at hudson.remoting.UserRequest.perform(UserRequest.java:153)
    at hudson.remoting.UserRequest.perform(UserRequest.java:50)
    at hudson.remoting.Request$2.run(Request.java:336)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.141 s
[INFO] Finished at: 2017-02-13T11:23:42-05:00
[INFO] Final Memory: 31M/266M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project example-project: Exception in provider:
[ERROR] Cannot instantiate class com.thecompany.util.result.CustomReportListener: ExceptionInInitializerError: NullPointerException
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project example-project: Exception in provider
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:133)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
    at hudson.remoting.UserRequest.perform(UserRequest.java:153)
    at hudson.remoting.UserRequest.perform(UserRequest.java:50)
    at hudson.remoting.Request$2.run(Request.java:336)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoFailureException: Exception in provider
    at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:328)
    at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:318)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:892)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:755)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 31 more
Caused by: org.apache.maven.surefire.booter.SurefireExecutionException: Exception in provider
    at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:87)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1010)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:862)
    ... 34 more
Caused by: org.testng.TestNGException: 
Cannot instantiate class com.thecompany.util.result.CustomReportListener
    at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:53)
    at org.testng.TestNG.initializeConfiguration(TestNG.java:981)
    at org.testng.TestNG.run(TestNG.java:1089)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:202)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:155)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:81)
    at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:82)
    ... 36 more
Caused by: java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:51)
    ... 49 more
Caused by: java.lang.NullPointerException
    at sun.awt.shell.Win32ShellFolder2.access$200(Win32ShellFolder2.java:72)
    at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:242)
    at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:237)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:547)
    ... 1 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[JENKINS] Archiving C:\Program Files (x86)\Jenkins\jobs\QA_FOC_Brochures_Alpha\workspace@2\pom.xml to com.thecompany.automation/example-project/2.0.0-SNAPSHOT/example-project-2.0.0-SNAPSHOT.pom
channel stopped
Finished: FAILURE

此外,如果我在测试套件中删除了对CRL的调用,它将尝试运行并在调用CRL的静态方法之一时返回此错误:

CRL静态方法调用错误

Tests run: 10, Failures: 10, Errors: 0, Skipped: 0, Time elapsed: 12.843 sec <<< FAILURE! - in TestSuite
init(ca.alpha.desktop.TC_FOC_Brochures)  Time elapsed: 0.39 sec  <<< FAILURE!
java.lang.ExceptionInInitializerError
    at ca.alpha.desktop.TC_FOC_Brochures.init(TC_FOC_Brochures.java:98)
Caused by: java.lang.NullPointerException

...与:

Results :

Failed tests: 
ca.ford.desktop.TC_FOC_Brochures.init(ca.alpha.desktop.TC_FOC_Brochures)
  Run 1: TC_FOC_Brochures.init:98 ExceptionInInitializer
  Run 2: TC_FOC_Brochures.init:98 NoClassDefFound Could not initialize class com.thecom...

有没有人遇到这样的错误?我从哪里开始?提前谢谢。

2 个答案:

答案 0 :(得分:2)

替换该行(因javax.swing.filechooser.FileSystemView而失败)

public static final String BACKUP_DIRECTORY =
        FileSystemView.getFileSystemView().getHomeDirectory().getAbsolutePath() + "\\Selenium Results\\";

通过

public static final String BACKUP_DIRECTORY =
        System.getProperty("user.home") + "\\Selenium Results\\";

它应该按预期工作。

答案 1 :(得分:0)

如果您的maven正在正确编译代码并且.class文件存在于目标文件夹中。然后

提到Maven的依赖性:

<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>2.1.0</version>
</dependency>

保存文件并重新运行,这将解决问题