Maven 没有 bin 文件夹,因为 POM 文件中提到的所有依赖 JAR 文件都已下载并保存在 ${user.home}/.m2 文件夹中。如果您想从命令行触发 TestNG 测试用例,您可以通过在 POM 中配置插件来使用用于 TestNG 的 Maven Surefire 插件。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<failIfNoTests>true</failIfNoTests>
<skipTests>false</skipTests>
<suiteXmlFiles>
<suiteXmlFile>${testNGXMLFile}</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>true</value>
</property>
</properties>
<workingDirectory>${basedir}</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
然后在命令提示符下,您可以使用 maven 触发
mvn clean test -DtestNGXMLFile=src\test\resources\testng.xml
有关用于 testng 的 apache maven-surefire-plugin 的更多信息