sormuras commented on a change in pull request #13: Emit a warning instead of throwing an exception URL: https://github.com/apache/maven-compiler-plugin/pull/13#discussion_r290896067
########## File path: src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java ########## @@ -369,9 +369,11 @@ else if ( Double.valueOf( getTarget() ) < Double.valueOf( MODULE_INFO_TARGET ) ) // very odd // Means that main sources must be compiled with -modulesource and -Xmodule:<moduleName> // However, this has a huge impact since you can't simply use it as a classpathEntry - // due to extra folder in between - throw new UnsupportedOperationException( "Can't compile test sources " - + "when main sources are missing a module descriptor" ); + // due to extra folder in between ... or the user wants to test his main code on the + // classpath used by a named module ... or ... + getLog().warn( "Modular black-box test compilation with no main module?!" ); + + // TODO classpathElements = List.of( mainOutputDirectory ); Review comment: I already excluded that case from an example project: https://github.com/micromata/sawdust/blob/master/pom.xml#L15 But, I might have found a valid use-case today: say you want to test an external module (on the module path) without writing main code on your own. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to 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 With regards, Apache Git Services