简体   繁体   English

从命令行运行带有selenium(TestNG)的maven项目需要什么配置?

[英]What configuration required to run maven project with selenium (TestNG) from command line?

从命令行运行maven项目所需的配置。

Very Nice question. 非常好的问题。 I had also stuck with same question but I have found solution. 我也遇到了同样的问题,但我找到了解决办法。 Required two maven plug-ins which are given under. 需要两个maven插件。 Please make sure your JDK 1.7 and JRE 7 version is configure in your project. 请确保在项目中配置了JDK 1.7和JRE 7版本。 Add this plugin to your pom.xml and follow this step: 将此插件添加到您的pom.xml并按照以下步骤操作:

1 mvn clean 1 mvn清洁

2 mvn install 2 mvn安装

3 mvn exec:java 3 mvn exec:java

Step 3 is required to run project without specify main class 步骤3是运行项目而不指定主类所必需的

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
                 <configuration>
                         <source>1.7</source>
                         <target>1.7</target>
                         <encoding>${project.build.sourceEncoding}</encoding>
                         <showDeprecation>true</showDeprecation>
                         <showWarnings>true</showWarnings>
                         <executable>${env.JAVA_HOME}/bin/javac</executable>
                         <fork>true</fork>
                 </configuration>
            </plugin>
            <plugin>  
                   <groupId>org.codehaus.mojo</groupId>  
                   <artifactId>exec-maven-plugin</artifactId>  
                   <version>1.2.1</version>  
                   <configuration>  
                      <mainClass>com.mainClass</mainClass>  
                   </configuration>  
             </plugin> 

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

相关问题 如何在没有testng / maven的情况下从命令行运行Selenium Webdriver测试用例 - How to run selenium webdriver test cases from command line without testng/maven 如何在mac中通过命令行运行maven项目的testng脚本 - How to run the testng script of maven project through the command line in mac 创建黄瓜java testng maven可执行jar项目并从命令行运行 - create cucumber java testng maven executable jar project and run from command line Maven项目(Cucumber + TestNG + Selenium-Java)测试无法使用mvn clean install在命令行上运行测试 - Maven Project(Cucumber+TestNG+Selenium-Java] Test Can't Run test on command line with mvn clean install 如何从命令提示符下运行Maven项目testng.xml - how to run maven project testng.xml from the command prompt 如何从 Maven 命令行运行 testng.xml - How to run testng.xml from Maven command line 如何从命令行使用多个程序包运行Selenium testNG文件? - How to run a Selenium testNG file from Command Line with multiple packages? 从命令行运行具有依赖项的 maven 项目 - run maven project with dependencies from command line 使用命令行和命令行中的xml来执行Maven / TestNG项目? - Execute Maven/TestNG project using command line and DIFFERENT xml from command line? Maven TestNG 测试未从命令行运行 - Maven TestNG Test not running from Command Line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM