Giter Site home page Giter Site logo

Comments (2)

sormuras avatar sormuras commented on July 17, 2024

The console launcher already has:

RUNTIME CONFIGURATION

      -cp, --classpath, --class-path=PATH
                             Provide additional classpath entries -- for example, for adding
                               engines and their dependencies. This option can be repeated.

You suggest to add:

      --module-path=PATH
                             Provide additional module-path entries -- for example, for adding
                               engines and their dependencies. This option can be repeated.

Right?

The underlying issue is that java -jar APP.jar always launches applications on the class-path; i.e. in the unnamed module. That's why you need to resort to the long-form version as shown in your initial snippet. Which could be written a bit shorter:

    java --module-path libs:build/jar \
        --add-modules ALL-MODULE-PATH \ // make all modules part of the module graph
        --module org.junit.platform.console \  // root module is added automatically
        execute \
          --scan-modules \ // let junit engines find tests in all modules
          --reports-dir build/junit

Now, starting off on the class-path, some code in JUnit needs to figure out how to create a module layer at runtime in order to match the configuration the user wants: which could be a combination of all module system related options java offers. Which include: --module-path, --add-exports, --add-modules, --add-opens, --limit-modules, --patch-module, --upgrade-module-path``. Thus, when adding --module-path` to the set of JUnit's console options, we should also consider adding some or all others. And this can turn into a maintainance burden.

I'd rather see java to support an optional modular launcher protocol where java --multi-module-jar APP.jar would a) run on the module path and b) support running with multi-module JARs where many named modules are packaged into a single file.

from junit5.

sormuras avatar sormuras commented on July 17, 2024

In addition to the manual and command-line centric "add test module into the graph configuration" above, it would be interesting to explore a programmatic approach using Java's ServiceLoader SPI. Analog to what Testable is for @Test methods - you would make your test modules provide a SelectModuleForTesting implementation which then is loaded by the JUnit Platform via uses SelectModuleForTesting;.

With that in place, no extra configuration is needed on the command-line - not left, nor right of execute.

from junit5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.