运行maven项目时出错

时间:2016-08-12 09:33:02

标签: maven maven-3 appium appium-ios

我是maven项目的新手 我在运行maven项目时遇到问题。我的项目使用了appium。

错误是

Exception in thread "main" java.lang.NoClassDefFoundError: io/appium/java_client/AppiumDriver
at grab.main.Main.main(Main.java:13)
Caused by: java.lang.ClassNotFoundException: io.appium.java_client.AppiumDriver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

我的pom是

    <dependency>              
      <groupId>org.seleniumhq.selenium</groupId>                              
        <artifactId>selenium-java</artifactId>                              
        <version>2.48.2</version>                               
     </dependency>           
     <dependency>              
        <groupId>org.testng</groupId>                               
        <artifactId>testng</artifactId>                             
        <version>6.8.5</version>                              
        <scope>test</scope>                                     
    </dependency>
    <dependency>              
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>                             
        <version>4.1.1</version>                              
        <scope>test</scope>                                     
    </dependency>
 </dependencies>

提前致谢

1 个答案:

答案 0 :(得分:1)

您只为测试<scope>test</scope>添加Java-Client的依赖项。删除范围,并且在运行时可以使用依赖项:

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