[ 
https://issues.apache.org/jira/browse/SUREFIRE-1768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Scholte closed SUREFIRE-1768.
------------------------------------
      Assignee: Robert Scholte
    Resolution: Not A Problem

This works as designed: the patch acts as an override.

Simone Bordet gave me the following codesnippet of 
{{ModulePatcher.PatchedModuleReader.find(String name)}}:
{code:java}
Resource r = findResourceInPatch(name);
if (r != null) {
URI uri = URI.create(r.getURL().toString());
return Optional.of(uri);
} else {
return delegate().find(name);
}
{code}

Alan Bateman gave another piece of code that gives the list of resources in the 
module so you can see the effect of the patching:
{code:java}
        String name = this.getClass().getModule().getName();
        ModuleLayer.boot()
                .configuration()
                .findModule(name)
                .orElseThrow()
                .reference()
                .open()
                .list()
                .forEach(System.out::println)
{code}


> Main classes not included in classpath when using Java Modules
> --------------------------------------------------------------
>
>                 Key: SUREFIRE-1768
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1768
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 3.0.0-M4
>         Environment: Windows 10, JDK 11
>            Reporter: László Stahorszki
>            Assignee: Robert Scholte
>            Priority: Major
>
> According to the 
> [documentation|http://maven.apache.org/surefire/maven-surefire-plugin/examples/configuring-classpath.html],
>  the `classes` directory should be put on the classpath by default.
> In this case, given that I have a `demo` package in both my main sources and 
> my test source, the enumeration 
> `classLoader.getResources({color:#6a8759}"demo"{color})` should have 2 URLs 
> in it. One for the package in the test sources and one for the main sources.
> When using the Java Module System, this is not the case. Instead, I get two 
> URLs, both for the test sources. This error does not occur when not using the 
> module system.
> I created a repository, which can reproduce this error. It can be found 
> [here|https://github.com/rolaca11/test-classpath-demo]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to