Maven 项目在没有 ide 的情况下执行

Maven project execute without ide

我使用 Maven 进行了 selenium 测试。我考了20多个类。如何在没有 ide 的情况下导出和 运行 它们? 我也是用的POM结构

首先导航到项目 pom.xml 所在的文件夹。

cd DirectoryWherePOMisLocated

然后执行下面的命令,

mvn clean -Dtest=classNameWhichYouWantToExecute install

如果你想执行多个 类 只需在 -Dtest 参数中用 , 将它们分开。

希望对您有所帮助!!

只需打开 terminal/cmd,导航到您的项目目录并使用 maven 命令:

mvn clean test
  • clean — 删除目标目录
  • 测试 — 运行 测试

如果你想指定 class 你想要 运行(不像上面那样)你可以 运行 像建议的 -Dtest 参数:

mvn clean -Dtest=testClass install