简体   繁体   English

运行 maven 命令,DOT 无法将 TestNG 套件作为参数传递

[英]Run maven command with the DOT not working for passing TestNG suite as parameters

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
                <suiteXmlFiles>
                    <!-- pass testng.xml files as argument from command line -->
                    <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
    </plugins>
</build>

How to pass this variable now with mvn command?现在如何使用 mvn 命令传递此变量? Tried:试过:

mvn clean install test -DsuiteXmlFile=testng-suite.xml 
mvn clean test -Dsurefire.suiteXmlFiles=testng-suite.xml

Always getting the error, seems like connected to.总是出现错误,似乎已连接。 (dot) symbol not treated as expected: (点)符号未按预期处理:

Unknown lifecycle phase ".xml".未知的生命周期阶段“.xml”。 You must specify a valid lifecycle phase or a goal in the format: or...您必须以以下格式指定有效的生命周期阶段或目标:或...

Unknown lifecycle phase ".suiteXmlFiles=testng-suite.xml".未知的生命周期阶段“.suiteXmlFiles=testng-suite.xml”。 You must specify a valid lifecycle phase or a goal您必须指定有效的生命周期阶段或目标

Same problem have when passing any properties - treats dot as some lifecycle phase...传递任何属性时都会出现同样的问题 - 将点视为某个生命周期阶段......

do it like this像这样做

mvn -DsuiteXmlFile=testng-suite.xml  clean install test 
mvn -Dsurefire.suiteXmlFiles=testng-suite.xml clean test 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM