簡體   English   中英

無法在 Eclipse 的 Maven 項目中找到 bin 文件夾

[英]Not able to find bin folder in Maven project in Eclipse

要從命令提示符運行 testng 測試,我必須設置類路徑並運行測試 C:\\newworkspace\\SeleniumSample>set classpath = C:\\newworkspace\\SeleniumSample\\bin; C:\\newworkspace\\SeleniumSample\\lib*

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

我的 Maven 項目不包含 bin 或 lib 文件夾。我手動創建了 lib 文件夾並將 jar 添加到此文件夾中。任何幫助都會很棒。

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 的更多信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM