You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Lamy (JIRA)" <ji...@codehaus.org> on 2010/01/27 14:46:55 UTC

[jira] Commented: (MNG-4548) Thread.currentThread().getContextClassLoader().getResource doesn't find resource

    [ http://jira.codehaus.org/browse/MNG-4548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=208328#action_208328 ] 

Olivier Lamy commented on MNG-4548:
-----------------------------------

in TargetMojo#execute
{code}
    // the file /META-INF/persistence.xml is included in the dependency sonar-plugin-api-1.12.jar
    
    URL resource = getClass().getResource("/META-INF/persistence.xml");
    System.out.println("getClass().getResource(): " + resource);

    resource = getClass().getClassLoader().getResource("/META-INF/persistence.xml");
    System.out.println("getClass().getClassLoader().getResource(): " + resource);

    resource = Thread.currentThread().getContextClassLoader().getResource("/META-INF/persistence.xml");
    System.out.println("Thread.currentThread().getContextClassLoader().getResource(): " + resource);
{code}

> Thread.currentThread().getContextClassLoader().getResource doesn't find resource 
> ---------------------------------------------------------------------------------
>
>                 Key: MNG-4548
>                 URL: http://jira.codehaus.org/browse/MNG-4548
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Class Loading
>    Affects Versions: 3.0-alpha-6
>            Reporter: Olivier Lamy
>
> Thread.currentThread().getContextClassLoader().getResource cannot find a resource whereas getClass().getResource find it.
> Sample to test it :
> svn co https://svn.codehaus.org/mojo/branches/sonar-maven-plugin-mvn-3.x/experimental/
> cd experimental
> mvn clean install -Prun-its -Dinvoker.streamLogs=true

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira