[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-11-17 Thread Tibor Digana (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16690667#comment-16690667
 ] 

Tibor Digana commented on SUREFIRE-1531:


https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=commit;h=2ccba319efc4248197ce307515540f1c56faa9c5

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Assignee: Tibor Digana
>Priority: Major
> Fix For: 3.0.0-M2
>
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-11-17 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16690435#comment-16690435
 ] 

ASF GitHub Bot commented on SUREFIRE-1531:
--

Tibor17 commented on issue #189: [SUREFIRE-1531] Option to disable Java 9 
modules
URL: https://github.com/apache/maven-surefire/pull/189#issuecomment-439598184
 
 
   @lukas-krecan 
   I had to slightly modify your code but kept you as an author and created a 
branch:
   
https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=shortlog;h=refs/heads/SUREFIRE-1531
   You can review it. I want to push it and close Jira. Then pls close this PR 
if you have no objections.


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:
us...@infra.apache.org


> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Assignee: Tibor Digana
>Priority: Major
> Fix For: 3.0.0-M2
>
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-10-24 Thread Tibor Digana (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16662468#comment-16662468
 ] 

Tibor Digana commented on SUREFIRE-1531:


[~pdolezal] Sorry, we are very busy with new version 3.0 and new feature 
support in JUnit 5 working on it every day. We are working on two parallel 
codelines (version 2.22.2 and 3.0.0-M1). I will try to assign this fix to one 
of these two versions whichever comes first.

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-10-23 Thread Petr Dolezal (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16661262#comment-16661262
 ] 

Petr Dolezal commented on SUREFIRE-1531:


I hope my two cents hits the right target: I experienced very similar problem 
with {{IllegalAccessError}} as described above as well, but it was plain JUnit 
5 test.

After a while of exploring, I found out that the problem disappears when 
anything that JUnit needs to touch with reflection, e.g., {{@Test}} methods or 
methods for {{@MethodSource}} is public and the package is exported. Of course, 
this is not very good and for not exported packages it is completely useless.

However, I peeked at the command line that Surefire produces to run the tests 
and I tried to run the commands manually. I believe that the problem could be 
fixed actually quite easily. Instead of just {{--add-exports}} a more powerful 
{{--add-opens}} switch can do the trick as it effectively enables almighty 
reflection for the code. Then JUnit worked fine again and could access even 
non-public members.

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-08-17 Thread Stephen Colebourne (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16583862#comment-16583862
 ] 

Stephen Colebourne commented on SUREFIRE-1531:
--

The PR is basically what I want. Note sure that "disableModules" is clear 
enough as a property name though.

The existing plugin also contains the same bug as MJAVADOC-506, namely that 
excluding the module-info.java file using configuration does not cause the 
plugin to ignore it when determining how to test. ( existsModuleDescriptor() 
does not take into account file excludes).

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-08-17 Thread Robert Scholte (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16583705#comment-16583705
 ] 

Robert Scholte commented on SUREFIRE-1531:
--

I consider this as a duplicate of SUREFIRE-1497

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-08-14 Thread Tibor Digana (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16580433#comment-16580433
 ] 

Tibor Digana commented on SUREFIRE-1531:


[~scolebou...@joda.org]
If issue 1497 is a duplicate, you can close it and I will use the sources from 
pull request. Let me just refactor it and run the build. The PR is okay for you?

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-08-14 Thread Stephen Colebourne (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16580418#comment-16580418
 ] 

Stephen Colebourne commented on SUREFIRE-1531:
--

This is the same fundamental request as SUREFIRE-1497. We really do need a way 
to switch between using the modulepath and ignoring it at runtime for testing 
purposes.

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-05 Thread Tibor Digana (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16533441#comment-16533441
 ] 

Tibor Digana commented on SUREFIRE-1531:


[~lukas_krecan]
Did you post an issue for Mockito on GitHub?
If not yet, then pls do it and link their issue with this Jira ticket. We will 
see where the root cause is.
Thx.

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread JIRA


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529204#comment-16529204
 ] 

Lukáš Křečan commented on SUREFIRE-1531:


The test case:
{code:java}
import org.junit.Test;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.scheduling.TaskScheduler;

import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;

public class SimpleTest {

@Test
public void test() {
MyScheduler mock = mock(MyScheduler.class);
assertNotNull(mock);
}

interface MyScheduler extends TaskScheduler, DisposableBean {

}
}

{code}
Fails with:
{code:java}
Underlying exception : java.lang.IllegalStateException: Error invoking 
(accessor)::defineClass
at 
shedlock.example/net.javacrumbs.shedlockexample.SimpleTest.test(SimpleTest.java:29)
Caused by: java.lang.IllegalStateException: Error invoking 
(accessor)::defineClass
at 
shedlock.example/net.javacrumbs.shedlockexample.SimpleTest.test(SimpleTest.java:29)
Caused by: java.lang.IllegalAccessError: class 
org.mockito.codegen.MyScheduler$MockitoMock$1440016807 cannot access its 
superinterface net.javacrumbs.shedlockexample.SimpleTest$MyScheduler
at 
shedlock.example/net.javacrumbs.shedlockexample.SimpleTest.test(SimpleTest.java:29)
{code}

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread Robert Scholte (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529198#comment-16529198
 ] 

Robert Scholte commented on SUREFIRE-1531:
--

I am aware of several issues with IntelliJ and the difference between there 
modulepath/classpath resolution compared to Maven. IMO IDEs should follow the 
logic of the used build tool, so for me it is first of all important it works 
for Maven.

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread JIRA


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529195#comment-16529195
 ] 

Lukáš Křečan commented on SUREFIRE-1531:


Ok, if I should generalize the use case it's this:

In tests, I use additional dependencies. Some of them (like Mockito) use 
reflection or code generation that needs access (opens or sometimes even 
exports) to potentially all dependencies of the main module.

IntelliJ currently executes tests with classpath - not sure if it's a bug or 
feature https://youtrack.jetbrains.com/issue/IDEA-171419

 

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread Robert Scholte (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529131#comment-16529131
 ] 

Robert Scholte commented on SUREFIRE-1531:
--

I agree with Tibor. Disabling modules should only be done if there's absolutely 
no other solution. Let's examine this usecase with [~sor] to figure out what 
would be the ultimate set of extra arguments to make this work.

> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add each such dependencies to Surefire configuration, which does not make 
> much sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at ( and I am still getting IllegalAccessErrors)
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529104#comment-16529104
 ] 

ASF GitHub Bot commented on SUREFIRE-1531:
--

lukas-krecan commented on issue #189: [SUREFIRE-1531] Option to disable Java 9 
modules
URL: https://github.com/apache/maven-surefire/pull/189#issuecomment-401608493
 
 
   It's described in https://issues.apache.org/jira/browse/SUREFIRE-1531


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:
us...@infra.apache.org


> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add such dependencies to Surefire configuration, which does not make much 
> sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at and I am still getting IllegalAccessErrors
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529033#comment-16529033
 ] 

ASF GitHub Bot commented on SUREFIRE-1531:
--

Tibor17 commented on issue #189: [SUREFIRE-1531] Option to disable Java 9 
modules
URL: https://github.com/apache/maven-surefire/pull/189#issuecomment-401596152
 
 
   @lukas-krecan 
   Jigsaw modularity is enabled if `module-info` is found. Why you want to 
disable it if still the compiler produced it and the application therefore 
should use it?


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:
us...@infra.apache.org


> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add such dependencies to Surefire configuration, which does not make much 
> sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at and I am still getting IllegalAccessErrors
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16528999#comment-16528999
 ] 

ASF GitHub Bot commented on SUREFIRE-1531:
--

lukas-krecan commented on issue #189: [SUREFIRE-1531] Option to disable Java 9 
modules
URL: https://github.com/apache/maven-surefire/pull/189#issuecomment-401588520
 
 
   Still needs some work


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:
us...@infra.apache.org


> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add such dependencies to Surefire configuration, which does not make much 
> sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at and I am still getting IllegalAccessErrors
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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


[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16528998#comment-16528998
 ] 

ASF GitHub Bot commented on SUREFIRE-1531:
--

lukas-krecan closed pull request #189: [SUREFIRE-1531] Option to disable Java 9 
modules
URL: https://github.com/apache/maven-surefire/pull/189
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index fa1921468..cb81856f3 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -112,6 +112,7 @@
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 
+import static java.lang.Boolean.TRUE;
 import static java.lang.Thread.currentThread;
 import static java.util.Arrays.asList;
 import static java.util.Collections.addAll;
@@ -753,6 +754,14 @@
 @Parameter( property = "dependenciesToScan" )
 private String[] dependenciesToScan;
 
+/**
+ * Disables Java 9 modular classpath even if module-info.java is enabled
+ *
+ * @since 2.22.1
+ */
+@Parameter( property = "disableModules" )
+private Boolean disableModules;
+
 /**
  *
  */
@@ -985,7 +994,7 @@ boolean verifyParameters()
 if ( !getTestClassesDirectory().exists()
 && ( getDependenciesToScan() == null || 
getDependenciesToScan().length == 0 ) )
 {
-if ( Boolean.TRUE.equals( getFailIfNoTests() ) )
+if ( TRUE.equals( getFailIfNoTests() ) )
 {
 throw new MojoFailureException( "No tests to run!" );
 }
@@ -2135,7 +2144,7 @@ private ForkConfiguration getForkConfiguration() throws 
MojoFailureException
 
 Platform platform = PLATFORM.withJdkExecAttributesForTests( 
getEffectiveJvm() );
 
-if ( platform.getJdkExecAttributesForTests().isJava9AtLeast() && 
existsModuleDescriptor() )
+if ( platform.getJdkExecAttributesForTests().isJava9AtLeast() && 
modulesEnabled() && existsModuleDescriptor() )
 {
 return new ModularClasspathForkConfiguration( bootClasspath,
 tmpDir,
@@ -3671,6 +3680,21 @@ public void setDependenciesToScan( String[] 
dependenciesToScan )
 this.dependenciesToScan = dependenciesToScan;
 }
 
+private boolean modulesEnabled()
+{
+return !TRUE.equals( getDisableModules() );
+}
+
+public Boolean getDisableModules()
+{
+return disableModules;
+}
+
+public void setDisableModules( Boolean disableModules )
+{
+this.disableModules = disableModules;
+}
+
 public PluginDescriptor getPluginDescriptor()
 {
 return pluginDescriptor;


 


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:
us...@infra.apache.org


> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add such dependencies to Surefire configuration, which does not make much 
> sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at and I am still getting IllegalAccessErrors
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports 

[jira] [Commented] (SUREFIRE-1531) Option to switch-off Java 9 modules

2018-07-01 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SUREFIRE-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16528997#comment-16528997
 ] 

ASF GitHub Bot commented on SUREFIRE-1531:
--

lukas-krecan opened a new pull request #189: [SUREFIRE-1531] Option to disable 
Java 9 modules
URL: https://github.com/apache/maven-surefire/pull/189
 
 
   


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:
us...@infra.apache.org


> Option to switch-off Java 9 modules
> ---
>
> Key: SUREFIRE-1531
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1531
> Project: Maven Surefire
>  Issue Type: Improvement
>  Components: Maven Surefire Plugin
>Affects Versions: 2.22.0
>Reporter: Lukáš Křečan
>Priority: Major
>
> I am working on a library and I am adding support for Java 9 modules. 
> Surefire 2.21.0 by default executes tests with Java 9 modules switched-on if 
> it detects module-info.java While it may make sense in some cases, in my case 
> I'd like the switch it off.
> The reason is simple. I am using Mockito to mock an interface that extends a 
> Spring interface. Mockito has to create an implementation of this interface 
> (proxy or subclass) and for this it needs to have access to the Spring 
> interfaces. If Java 9 modules are enabled for the tests I have to manually 
> add such dependencies to Surefire configuration, which does not make much 
> sense. To makes things worse, the interface actually extends two Spring 
> interfaces form two different Spring modules so the configuration is almost 
> impossible to get right.
> So far I am at and I am still getting IllegalAccessErrors
> {code:java}
> --add-exports spring.context/org.springframework.scheduling=org.mockito
> --add-exports spring.beans/org.springframework.beans.factory=org.mockito
> {code}
> I would prefer to switch-off the Java 9 modules for the test module 
> altogether (same behavior as pre 2.21.0)
>  
> The test is here 
> [https://github.com/lukas-krecan/ShedLock/blob/java9/shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/CleanupTest.java]
>  
> If you want, I can send a pull request.



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