无法在Eclipse的Maven项目中找到bin文件夹

问题描述 投票:0回答:1

要从命令提示符运行testng测试,我必须设置类路径并运行测试C:\ newworkspace \ SeleniumSample>设置类路径= C:\ newworkspace \ SeleniumSample \ bin; C:\ newworkspace \ SeleniumSample \ lib *

C:\ newworkspace \ SeleniumSample> java org.testng.TestNG testng.xml

我的maven项目不包含bin或lib文件夹。我手动创建了lib文件夹,并将jar添加到该文件夹​​。任何帮助都将非常有用。

maven testng classpath bin lib
1个回答
0
投票

Maven没有bin文件夹,因为POM文件中提到的所有从属JAR文件都已下载并保存在$ {user.home} /。m2文件夹中。如果要从命令行触发TestNG测试用例,则可以通过在POM中配置Maven Surefire插件来使用TestNG。

<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

有关apache maven-surefire-plugin for testng的更多信息

© www.soinside.com 2019 - 2024. All rights reserved.