Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.7.0
-
None
-
Important
Description
When running a maven build on a maven project that has a module-info file and that has tests to compile, the build fails with the following message:
Execution default-testCompile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile failed: java.io.IOException: Invalid path to module descriptor: D:\projects\DCM\dcm-nct-tcp-connector-c.v-SNAPSHOT\target\classes
And I see that in the TestCompilerMojo class (line 273), the absolute output directory is passed in as the module descriptor, while in the compile of the production sources, the full path to the module-info.java file is passed in:
ResolvePathsRequest<String> request =
ResolvePathsRequest.withStrings( testPath )
.setMainModuleDescriptor( *mainOutputDirectory.getAbsolutePath()* );
For completeness I should maybe also add that I have changed my dependencies for the compiler plugin to be able to use java 10 and depend on multi-release jars (like log4j2 2.11):
<dependencies> <dependency> <groupId>org.ow2.asm</groupId> <artifactId>asm</artifactId> <version>6.1.1</version> <!-- Use newer version which fixes parsing of module-info.java --> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-java</artifactId> <version>0.9.4</version> <!-- Use newer version which fixes resolving module-info.class files in version folders of multi release jars (needed for log4j) --> </dependency> </dependencies>
Full stacktrace:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project dcm-nct-tcp-connector: Execution default-testCompile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile failed: java.io.IOException: Invalid path to module descriptor: D:\projects\DCM\dcm-nct-tcp-connector-c.v-SNAPSHOT\target\classes at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-testCompile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile failed: java.io.IOException: Invalid path to module descriptor: D:\projects\DCM\dcm-nct-tcp-connector-c.v-SNAPSHOT\target\classes at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: java.lang.RuntimeException: java.io.IOException: Invalid path to module descriptor: D:\projects\DCM\dcm-nct-tcp-connector-c.v-SNAPSHOT\target\classes at org.apache.maven.plugin.compiler.TestCompilerMojo.preparePaths(TestCompilerMojo.java:285) at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:762) at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:176) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more Caused by: java.io.IOException: Invalid path to module descriptor: D:\projects\DCM\dcm-nct-tcp-connector-c.v-SNAPSHOT\target\classes at org.codehaus.plexus.languages.java.jpms.LocationManager.resolvePaths(LocationManager.java:87) at org.apache.maven.plugin.compiler.TestCompilerMojo.preparePaths(TestCompilerMojo.java:281) ... 24 more
Attachments
Issue Links
- is superceded by
-
MCOMPILER-342 Unsupported class file major version 55
- Closed