简体   繁体   中英

Maven -DforkMode=never change user

When I run project, it uses one user (for example User1 ) that set in my runner class, but if I want to debug, and set -DforkMode=never parameter, project runs with another user (for example User 3 ). Can somebody explain this?

You can use -X as a maven option and it should print out the java command it runs to perform the tests, this might shed some light on the issue. Could you please post your full command for running your tests i believe -DforkMode=never isnt a valid maven option past surefire v2.14 but if you add the configuration like so:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <forkCount>0</forkCount>
    </configuration>
</plugin>

For more information see http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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