从命令行运行maven + eclipse

时间:2013-05-20 14:26:14

标签: java maven command-line

我使用下面的pom.xml

在eclipse中创建了一个maven项目
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.omniture.selenium</groupId>
<artifactId>Omniture</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>

    <dependency>
        <groupId>org.jbehave.web</groupId>
        <artifactId>jbehave-web-selenium</artifactId>
        <version>3.5.5</version>
    </dependency>

    <dependency>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave-core</artifactId>
        <version>3.8</version>
    </dependency>

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>2.0.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-artifact</artifactId>
        <version>2.0.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-project</artifactId>
        <version>2.0.11</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-archiver</artifactId>
        <version>1.2</version>
    </dependency>

</dependencies>

我想通过命令行运行JUnit测试用例。 以下是junit测试用例的路径:

/Users/support/Documents/Omniture/src/test/java/com/testOmnitureSelenium

1 个答案:

答案 0 :(得分:0)

mvn test -Dtest=<testclass>

如果你想运行一个给定的测试类,上面会为你做。但是,如上所述,当您调用包目标时,maven将自动运行测试,将上面的命令呈现给向导的黑暗角落,凡人不需要踏上。