Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1755

Put dependencies from module-info in test sources on module path

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0-M4
    • Fix Version/s: None
    • Component/s: Maven Surefire Plugin
    • Labels:
      None

      Description

      When testing a Maven project that contains a module-info.java in both the main source folder and the test source folder, modules that are required for testing only (such as org.junit.jupiter.api) are not put on the module path, causing the tests to fail with an exception similar to:

      java.lang.module.FindException: Module org.junit.jupiter.api not found, required by com.example.module

       It would be nice if Surefire patched the module-info in the main source folder with extra dependencies from the module-info in the test source folder.

      Example of main module-info.java:

      module com.example.module {
        exports com.example.module;
        requires com.example.another.module;
      }

      Example of test module-info.java:

      open module com.example.module {
        exports com.example.module;
        requires com.example.another.module;
        requires org.junit.jupiter.api;
      }

      This example implies that org.junit.jupiter.api would be available on the module path during testing, but not during regular compilation and runtime.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Nibsi Stephan van Hulst
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: