forax / pro

A Java build tool that works seamlessly with modules
GNU General Public License v3.0
103 stars 15 forks source link

Introduce tester.overrideArguments option #29

Closed sormuras closed 7 years ago

sormuras commented 7 years ago

The list of strings passed via tester.overrideArguments replace all other configuration arguments normally gathered by the plugin. See comments in https://github.com/forax/pro/commit/aed2faed92b0d53753f80017d35ae9a98864dd95

This commit also fixes the ConsoleLauncher arguments to exclude the "." path from classpath scanning. The JShell sets "java.class.path" to "." which should not be scanned for test classes.

sormuras commented 7 years ago

@forax The test tree of https://github.com/forax/pro/pull/29/commits/cb099265e7d53cf44c4a159cfbcdb2babefef203 shows an disabled test, that fails at the moment:

  JUnit Jupiter:ConfigsTests:newRootIsNotNull()
    MethodSource [
      className = 'com.github.forax.pro.api.impl.ConfigsTests', 
      methodName = 'newRootIsNotNull', methodParameterTypes = '']

    => java.lang.IllegalAccessError: 

class com.github.forax.pro.api.impl.ConfigsTests (in unnamed module @0x33065d67) 
cannot access class com.github.forax.pro.api.impl.Configs (in module com.github.forax.pro.api) 
because module com.github.forax.pro.api
does not export com.github.forax.pro.api.impl to unnamed module @0x33065d67

Both classes, Configs and ConfigsTests, reside in the same package, namely com.github.forax.pro.api.impl. The compiler plugin compiles them from the test/merged to the test/exploded directory.

Maybe, the IAE is because of tester being a module and passing the modular environment to the JUnit Platform? I see at least two solutions:

forax commented 7 years ago

About the IllegalAccessError, the problem is that the test are run from the classpath so they can not access to com.github.forax.pro.api.impl. The merged module-info should more exports less restricted but that's not the right solution, as you said, the right solution is to run the ConsoleLauncher in another VM, so