使用Maven-selenium插件的Maven类路径问题

时间:2012-02-14 15:55:13

标签: maven selenium

我们正在使用Maven 3.0.3并使用Maven Selenium插件尝试启动Selenium服务器。我们在pom中有这种依赖...

            <dependency> 
                    <groupId>org.seleniumhq.selenium</groupId> 
                    <artifactId>selenium-server</artifactId> 
                    <version>2.19.0</version> 
                    <classifier>noexe</classifier> 
            </dependency> 

然后在预集成阶段,我们尝试启动Selenium服务器......

    <build> 
            ... 
            <plugins> 
                    ... 
                    <plugin> 
                            <groupId>org.codehaus.mojo</groupId> 
                            <artifactId>selenium-maven-plugin</artifactId> 
                            <version>1.1</version> 
                            <executions> 
                                    <execution> 
                                            <id>start</id> 
                                            <phase>pre-integration-test</phase> 
                                            <goals> 
                                                    <goal>start-server</goal> 
                                            </goals> 
                                            <configuration> 
                                                    <background>true</background> 
                                                    <logOutput>true</logOutput> 
                                            </configuration> 
                                    </execution> 
                            </executions> 
                    </plugin> 

但服务器无法启动错误...

java.lang.NoClassDefFoundError: org/openqa/selenium/server/SeleniumServer
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.server.SeleniumServer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.openqa.selenium.server.SeleniumServer.  Program will exit.
Exception in thread "main"

我已经验证上面的依赖项包含缺少的类。我怎么能解决这个类路径问题,或者你能说出我在这里列出的设置有什么问题?

谢谢, - 戴夫

0 个答案:

没有答案