[
https://issues.apache.org/jira/browse/SUREFIRE-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17676704#comment-17676704
]
Michael Osipov commented on SUREFIRE-2142:
------------------------------------------
[~sjaranowski], what I a coincidence we talked about recently...
> user.dir is changed in forkCount=0
> ----------------------------------
>
> Key: SUREFIRE-2142
> URL: https://issues.apache.org/jira/browse/SUREFIRE-2142
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 3.0.0-M5
> Reporter: Ivan Iliev
> Priority: Major
>
> When *not* forking the tests, the
> {code:java}
> user.dir{code}
> system property is changed to the current [<workingDirectory>
> |https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#workingDirectory].
> This can have a fatal effect on code which reads files via for ex.
> FileInputStream.
> For ex. in a multi module maven project like:
> /root/f1/p1/p2/m1
> /root/f2/m2
> such that the reactor builds m2 -> m1, and m2 executes in forkCount=0, the
> user.dir will be set to /root/f2/m2, then any code in m1's build pipeline
> which tries to open a file(even with absolute path) via FileInputStream will
> fail.
> See
>
> {code:java}
> org.apache.maven.plugin.surefire.AbstractSurefireMojo#setupProperties ->
> result.setProperty( "user.dir", getWorkingDirectory().getAbsolutePath() ); ->
> org.apache.maven.plugin.surefire.AbstractSurefireMojo#executeProvider ->
> if ( isNotForking() )
> {
> createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1
> ).copyToSystemProperties();
> ...
> }
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)