Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CD71C200D01 for ; Fri, 22 Sep 2017 11:59:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CB97F1609BE; Fri, 22 Sep 2017 09:59:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ECF301609A7 for ; Fri, 22 Sep 2017 11:59:05 +0200 (CEST) Received: (qmail 77721 invoked by uid 500); 22 Sep 2017 09:59:05 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 77700 invoked by uid 99); 22 Sep 2017 09:59:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Sep 2017 09:59:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 81585D7AE5 for ; Fri, 22 Sep 2017 09:59:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 6wXSXZFR6ksp for ; Fri, 22 Sep 2017 09:59:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id DC1DD60EAD for ; Fri, 22 Sep 2017 09:59:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 2995AE0EEE for ; Fri, 22 Sep 2017 09:59:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 56335241E9 for ; Fri, 22 Sep 2017 09:59:00 +0000 (UTC) Date: Fri, 22 Sep 2017 09:59:00 +0000 (UTC) From: "Gunnar Morling (JIRA)" To: issues@maven.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SUREFIRE-1420) Support running unit tests in named Java 9 modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 22 Sep 2017 09:59:07 -0000 [ https://issues.apache.org/jira/browse/SUREFIRE-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gunnar Morling updated SUREFIRE-1420: ------------------------------------- Description: As far as I can tell, Surefire will run tests using the traditional classpath also on Java 9. When the project that is built is a named Java 9 module (i.e. it contains a module descriptor), it'd be desirable to have a way to run the tests using the module path instead. For that, the following things would be required: * Adding the currently built project and its dependencies to the module path instead of the class path when forking the java process running the tests * Adding a read edge from the currently built module to the used testing library, e.g. JUnit, if it's not present as a dependence in the module descriptor already (which it usually won't) * Patching the classes from _target/test-classes_ into the currently built module (as represented by the classes under _target/classes_) * Opening up packages containing tests to the testing library so they can be accessed reflectively I could perform these steps manually by applying the following configuration for the Surefire plug-in: {code} org.apache.maven.plugins maven-surefire-plugin 2.20.1 test --module-path=target/classes:/path/to/junit/junit/4.12/junit-4.12.jar: /path/to/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar --add-modules com.example,junit,hamcrest.core --add-reads com.example=junit --add-opens com.example/com.example.internal=junit --patch-module com.example=target/test-classes path/to/none {code} Ideally, an equivalent {{java}} invocation would be done by Surefire automatically when building a named module. was: As far as I can tell, Surefire will run tests using the traditional classpath also on Java 9. When the project that is built is a named Java 9 module (i.e. it contains a module descriptor), it'd be desirable to have a way to run the tests using the module path instead. For that, the following things would be required: * Adding the currently built project and its dependencies to the module path instead of the class path when forking the java process running the tests * Adding a read edge from the currently built module to the used testing library, e.g. JUnit, if it's not present as a dependence in the module descriptor already (which it usually won't) * Patching the classes from _target/test-classes_ into the currently built module (as represented by the classes under _target/classes_) * Opening up packages containing tests to the testing library so they can be accessed reflectively I could perform these steps manually by applying the following configuration for the Surefire plug-in: {code} org.apache.maven.plugins maven-surefire-plugin 2.20.1 test --module-path=target/classes:/path/to/junit/junit/4.12/junit-4.12.jar: /path/to/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar --add-modules com.example,junit,hamcrest.core --add-reads com.example=junit --add-opens com.example/com.example.internal=junit --patch-module com.example=target/test-classes path/to/none {code} Ideally, an equivalent {{java}} invocation would be done by Surefire automatically when building a named module. > Support running unit tests in named Java 9 modules > -------------------------------------------------- > > Key: SUREFIRE-1420 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1420 > Project: Maven Surefire > Issue Type: New Feature > Reporter: Gunnar Morling > > As far as I can tell, Surefire will run tests using the traditional classpath also on Java 9. When the project that is built is a named Java 9 module (i.e. it contains a module descriptor), it'd be desirable to have a way to run the tests using the module path instead. > For that, the following things would be required: > * Adding the currently built project and its dependencies to the module path instead of the class path when forking the java process running the tests > * Adding a read edge from the currently built module to the used testing library, e.g. JUnit, if it's not present as a dependence in the module descriptor already (which it usually won't) > * Patching the classes from _target/test-classes_ into the currently built module (as represented by the classes under _target/classes_) > * Opening up packages containing tests to the testing library so they can be accessed reflectively > I could perform these steps manually by applying the following configuration for the Surefire plug-in: > {code} > > org.apache.maven.plugins > maven-surefire-plugin > 2.20.1 > > > test > --module-path=target/classes:/path/to/junit/junit/4.12/junit-4.12.jar: > /path/to/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar > --add-modules com.example,junit,hamcrest.core > --add-reads com.example=junit > --add-opens com.example/com.example.internal=junit > --patch-module com.example=target/test-classes > > > path/to/none > > > > > {code} > Ideally, an equivalent {{java}} invocation would be done by Surefire automatically when building a named module. -- This message was sent by Atlassian JIRA (v6.4.14#64029)