File tree 1 file changed +18
-0
lines changed
src/main/java/org/apache/maven/plugin/compiler
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,18 @@ public class TestCompilerMojo extends AbstractCompilerMojo {
161
161
@ Parameter (defaultValue = "${project.build.directory}/generated-test-sources/test-annotations" )
162
162
private File generatedTestSourcesDirectory ;
163
163
164
+ /**
165
+ * <p>
166
+ * When {@code true}, uses the module path when compiling with a release or target of 9+ and
167
+ * <em>module-info.java</em> or <em>module-info.class</em> is present.
168
+ * When {@code false}, always uses the class path.
169
+ * </p>
170
+ *
171
+ * @since 3.11
172
+ */
173
+ @ Parameter (defaultValue = "true" )
174
+ private boolean useModulePath ;
175
+
164
176
@ Parameter (defaultValue = "${project.testClasspathElements}" , readonly = true )
165
177
private List <String > testPath ;
166
178
@@ -288,6 +300,12 @@ protected void preparePaths(Set<File> sourceFiles) {
288
300
testModuleDescriptor = result .getMainModuleDescriptor ();
289
301
}
290
302
303
+ if (!useModulePath ) {
304
+ pathElements = Collections .emptyMap ();
305
+ modulepathElements = Collections .emptyList ();
306
+ classpathElements = testPath ;
307
+ return ;
308
+ }
291
309
if (StringUtils .isNotEmpty (getRelease ())) {
292
310
if (Integer .parseInt (getRelease ()) < 9 ) {
293
311
pathElements = Collections .emptyMap ();
You can’t perform that action at this time.
0 commit comments