【问题标题】:Running maven+eclipse from command line [duplicate]从命令行运行 maven+eclipse [重复]
【发布时间】:2013-05-15 03:20:42
【问题描述】:

我用下面的 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

【问题讨论】:

  • Doesn't running package 在构建之前自动运行 JUnit 测试?
  • 我是一个新手。 :) 所以请指导我运行这个
  • 我告诉你,当你运行 package.json 时,maven 会自动为你运行单元测试。我无能为力了。
  • 感谢您的宝贵时间 :)

标签: java maven command-line


【解决方案1】:
mvn test -Dtest=<testclass>

如果你想运行一个给定的测试类,上面会为你做。但是,如前所述,当您调用 package 目标时,maven 会自动运行测试,将上面的命令渲染到巫师的黑暗角落,凡人无需踏足。

【讨论】:

  • 应该也投票赞成...
猜你喜欢
  • 2015-09-27
  • 2011-06-18
  • 1970-01-01
  • 2015-11-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-09
相关资源
最近更新 更多