运行 maven项目时出现错误
error occured when running maven project
我是 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>
提前致谢
您添加了 Java-Client 的依赖项,仅用于测试 <scope>test</scope>
。删除范围,依赖项在运行时可用:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.1.1</version>
</dependency>
我是 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>
提前致谢
您添加了 Java-Client 的依赖项,仅用于测试 <scope>test</scope>
。删除范围,依赖项在运行时可用:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.1.1</version>
</dependency>