You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christoph Läubrich (Jira)" <ji...@apache.org> on 2022/10/06 08:06:00 UTC

[jira] [Commented] (MJAVADOC-707) Plugin won't work if Automatic-Module-Name is used

    [ https://issues.apache.org/jira/browse/MJAVADOC-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17613357#comment-17613357 ] 

Christoph Läubrich commented on MJAVADOC-707:
---------------------------------------------

Any progress on this?

I have debugged this up to the point in AbstractJavadocMojo in addJavadocOptions, there is this code:


{code:java}
 if ( moduleSourceDir == null )
        {
            addArgIfNotEmpty( arguments, "-sourcepath",
                              JavadocUtil.quotedPathArgument( getSourcePath( sourcePaths ) ), false, false );
        }
        else if ( mainResolvePathResult == null
            || ModuleNameSource.MODULEDESCRIPTOR.equals( mainResolvePathResult.getModuleNameSource() ) )
        {
            addArgIfNotEmpty( arguments, "--module-source-path",
                              JavadocUtil.quotedPathArgument( moduleSourceDir.toString() ) );
        }
{code}

in the failing case, the moduleSourceDir is not null and thus the -sourcepath is never added as an option and then javadoc fails, if one specifies sourcepath in the mojo options manually everything works:


{code:java}
<configuration>
   <sourcepath>src/main/java</sourcepath>
   ...
</configuration>
{code}

so this seems to disable something in the module processing part...


> Plugin won't work if Automatic-Module-Name is used
> --------------------------------------------------
>
>                 Key: MJAVADOC-707
>                 URL: https://issues.apache.org/jira/browse/MJAVADOC-707
>             Project: Maven Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.1, 3.3.2, 3.4.0
>            Reporter: Christopher Tubbs
>            Priority: Critical
>
> Using Automatic-Module-Name in a manifest (an intermediate step to help transition to using modules) prevents this plugin from adding the necessary dependencies to the class path, so it can build javadocs.
> maven-compiler-plugin seems to work fine, as does surefire and all the others when Automatic-Module-Name entries appear in a project's jar manifests. However, this plugin, as of 3.3.1, still does not work correctly with these.
> Instead of using the traditional class path, this plugin seems to force treating the project as a module, even though it does not have any module-info.java files, and most of its dependencies have not transitioned to using modules.
> Here's a pull request that demonstrates adding the Automatic-Module-Name to the manifest for a multi-module (Maven module) project, that fails on the javadoc plugin:
> https://github.com/apache/accumulo/pull/2498 ; both javadoc:aggregate and javadoc:jar are known to fail. I did not test with any other mojos.
> Not supporting this feature holds all projects back from being able to transition to modules over time.
> http://branchandbound.net/blog/java/2017/12/automatic-module-name/
> https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleFinder.html#automatic-modules



--
This message was sent by Atlassian Jira
(v8.20.10#820010)