You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/02 12:30:00 UTC

[jira] [Commented] (MNG-6071) GetResource ('/) returns 'null' if build is started with -f

    [ https://issues.apache.org/jira/browse/MNG-6071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16706244#comment-16706244 ] 

ASF GitHub Bot commented on MNG-6071:
-------------------------------------

slachiewicz opened a new pull request #198: [MNG-6071] Normalize relative paths for working directory
URL: https://github.com/apache/maven/pull/198
 
 
   https://builds.apache.org/job/maven-box/job/maven/job/MNG-6520

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> GetResource ('/) returns 'null' if build is started with -f
> -----------------------------------------------------------
>
>                 Key: MNG-6071
>                 URL: https://issues.apache.org/jira/browse/MNG-6071
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.2.1, 3.3.1, 3.3.9
>         Environment: Windows 10 x64
> Tested in cmd.exe, git bash.
>            Reporter: Alexander Bender
>            Assignee: Sylwester Lachiewicz
>            Priority: Minor
>             Fix For: 3.6.x-candidate, waiting-for-feedback
>
>
> I set up a very simple test maven project with only a dependency to testNG.
> {code}
>     public class TestTest {
>     @Test
>     public void test() {
>         System.out.println(getClass().getResource("/"));
> {code}
> Depending on how I build this, the call either returns null or the expected directory. How is that?
> {code}
>     // Prints: file:/C:/workspace/test/testproject/target/test-classes/
>     mvn clean test -Dtest=TestTest -f pom.xml
>     // Prints: file:/C:/workspace/test/testproject/target/test-classes/
>     mvn clean test -Dtest=TestTest -f testproject/pom.xml
>     // Prints: null
>     mvn clean test -Dtest=TestTest -f ./pom.xml
>     // Prints: null
>     mvn clean test -Dtest=TestTest -f ./testproject/pom.xml
> {code}
> Note that the second call includes "./" after -f.
> I actually want to find out the /target folder regardless of scenario (testNG in IntelliJ, Maven, Jenkins Buid, ...). So far, this way has proven the most reliable.
> {code}
>         System.out.println(getClass().getResource("./"));
> {code}
> This seems to reliably point to file:/C:/workspace/test/testproject/target/test-classes/com/testproject/test. Would this be safer to use?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)