maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (Jira)" <j...@apache.org>
Subject [jira] [Commented] (MNG-6071) GetResource ('/) returns 'null' if build is started with -f
Date Thu, 06 Feb 2020 01:46:00 GMT

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

Hudson commented on MNG-6071:
-----------------------------

Build succeeded in Jenkins: Maven TLP » maven » MNG-5222 #4

See https://builds.apache.org/job/maven-box/job/maven/job/MNG-5222/4/

> 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.7.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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
(v8.3.4#803005)

Mime
View raw message