You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2018/06/04 19:43:00 UTC

[jira] [Closed] (MCOMPILER-343) Tests fail to compile in modularized project due to wrong module descriptor path being passed to plexus-java

     [ https://issues.apache.org/jira/browse/MCOMPILER-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte closed MCOMPILER-343.
------------------------------------
       Resolution: Fixed
         Assignee: Robert Scholte
    Fix Version/s: 3.7.1

> Tests fail to compile in modularized project due to wrong module descriptor path being passed to plexus-java
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: MCOMPILER-343
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-343
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.7.0
>            Reporter: Guy Mahieu
>            Assignee: Robert Scholte
>            Priority: Major
>             Fix For: 3.7.1
>
>
> 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:
> {noformat}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
> {noformat}
> 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:
> {code}
> ResolvePathsRequest<String> request =
>  ResolvePathsRequest.withStrings( testPath )
>  .setMainModuleDescriptor( *mainOutputDirectory.getAbsolutePath()* );
> {code}
>  
> 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):
> {code:xml}
> <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>
> {code}
>  
> Full stacktrace:
> {noformat}
> 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
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)