简体   繁体   中英

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. Please make sure your JDK 1.7 and JRE 7 version is configure in your project. Add this plugin to your pom.xml and follow this step:

1 mvn clean

2 mvn install

3 mvn exec:java

Step 3 is required to run project without specify main class

<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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM