如何在maven中调用Java main方法

时间:2015-02-03 07:21:23

标签: java maven selenium-webdriver automation

我在maven中调用java方法时遇到了一些问题

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3.2</version>    
        <goals>  
            <goal>java</goal>  
         </goals>     
       <configuration>               
           <mainClass>com.example.main</mainClass>
        </configuration> 
    </plugin>

运行pom.xml后,抛出错误并在下面给出

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project Test-QA: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-testng:jar:2.12.4 
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -        DartifactId=surefire-testng -Dversion=2.12.4 -Dpackaging=jar - Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the  file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire - DartifactId=surefire-testng -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-testng:jar:2.12.4
[ERROR] 
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR] 
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR] 
[ERROR] from the specified remote repositories:

任何人都可以给我一个解决方案

0 个答案:

没有答案