[ 
https://issues.apache.org/jira/browse/SUREFIRE-1262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17090436#comment-17090436
 ] 
Pavel_K commented on SUREFIRE-1262:
-----------------------------------

[~tibordigana] No, I think that is not correct.

 1) Try to remove all `requires` in API module-info and add to API the 
following class: @Entity public class User {}. If you don't add `requires 
java.persistence` you will get `package javax.persistence is not visible   
(package javax.persistence is declared in module java.persistence, but module 
com.foo.api does not read` compilation error. 

2) why do you think that javax.persistence-api-2.2.jar is unnamed module? Take 
a look at its manifest and you will see `Automatic-Module-Name: 
java.persistence`. 

3) It seems that you think if there is no module-info it must be on classpath. 
No, we can take any jar (without module-info), put it on module-path and use it 
as usual module. JPMS will create from such `plain jar`  automatic module. 
Automatic modules are plain JARs (no module descriptor) on the module path. 
Automatic modules ARE NOT unnamed modules.

Automatic Modules – We can include unofficial modules by adding existing JAR 
files to the module path. The name of the module will be derived from the name 
of the JAR. Automatic modules will have full read access to every other module 
loaded by the path.
Unnamed Module – When a class or JAR is loaded onto the classpath, but not the 
module path, it's automatically added to the unnamed module. It's a catch-all 
module to maintain backward compatibility with previously-written Java code. 

Take a look here https://stackoverflow.com/a/46742802/5057736 

So, it seems my code is right, by surefire has problems with automatic modules.

> Add modulepath support
> ----------------------
>
>                 Key: SUREFIRE-1262
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1262
>             Project: Maven Surefire
>          Issue Type: Improvement
>            Reporter: Robert Scholte
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 2.21.0
>
>
> With the Jigsaw project Java9 is extended with a modulepath. This means that 
> surefire should be executed in a different way.
> When working with a modulepath, the Classpath in the MANIFEST of the 
> executable jar will be ignored, you need need to add everything on 
> commandline. 
> Just like javadoc, the java executable has an {{@<file>}} option, where you 
> can add arguments per line. So this is the new preferred way to build the 
> module-path.
> IIUC for surefire it is important to add {{--patch-module 
> target/test-classes}} (was: -Xpatch) which makes it possible to use the same 
> packages as target/classes.



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

Reply via email to