Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javadoc Mojo cannot handle true "modular" projects #58

Closed
mbooth101 opened this issue Aug 5, 2020 · 3 comments · Fixed by #75
Closed

Javadoc Mojo cannot handle true "modular" projects #58

mbooth101 opened this issue Aug 5, 2020 · 3 comments · Fixed by #75
Assignees

Comments

@mbooth101
Copy link
Contributor

mbooth101 commented Aug 5, 2020

For projects using the "module path" instead of the "class path" the javadoc mojo does not work. You see errors such as this:

[INFO] --- xmvn-mojo:3.1.0:javadoc (default-cli) @ jakarta.xml.bind-api ---
/home/mbooth/git/jaxb-api/jaxb-api/src/main/java/module-info.java:18: error: module not found: jakarta.activation
    requires transitive jakarta.activation;
                               ^

I was able to successfully build Javadoc with xmvn by making this change:

diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java
index 173bdaa9..e140852d 100644
--- a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java
+++ b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java
@@ -215,7 +215,7 @@ public class JavadocMojo
             opts.add( "-version" );
             opts.add( "-Xdoclint:none" );
 
-            opts.add( "-classpath" );
+            opts.add( "--module-path" );
             opts.add( quoted( StringUtils.join( getClasspath().iterator(), ":" ) ) );
             opts.add( "-encoding" );
             opts.add( quoted( encoding ) );

But I would be surprised if it was as simple as passing --module-path instead of -classpath for modular projects. The maven-javadoc-plugin seems to have some amount of code for dealing with it: https://github.com/apache/maven-javadoc-plugin/blob/master/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java

@mizdebsk
Copy link
Member

mizdebsk commented Aug 5, 2020

In XMvn there is no support for JPMS yet, but I will try to add it, at least to Javadoc MOJO.
It would help if you could provide a simple project demonstrating the issue that could be used as a test case - ideally modularize xmvn-it/src/test/resources/testJavadoc test case and add it as a new test, eg. testJavadocModules.

@mbooth101
Copy link
Contributor Author

In XMvn there is no support for JPMS yet, but I will try to add it, at least to Javadoc MOJO.
It would help if you could provide a simple project demonstrating the issue that could be used as a test case - ideally modularize xmvn-it/src/test/resources/testJavadoc test case and add it as a new test, eg. testJavadocModules.

Sure I can probably do that

mbooth101 added a commit to mbooth101/xmvn that referenced this issue Aug 5, 2020
@mbooth101
Copy link
Contributor Author

I pushed this change to a branch on my fork: mbooth101@bbab8b4

In which I added an IT, and you can compare the output like this:

$ cd xmvn-it/src/test/resources/testJavadocJPMS
$ JAVA_HOME=/usr/lib/jvm/java-11 mvn clean verify javadoc:aggregate
... successful build ...
$ JAVA_HOME=/usr/lib/jvm/java-11 mvn clean verify org.fedoraproject.xmvn:xmvn-mojo:4.0.0-SNAPSHOT:javadoc
... failed build ...

Does that help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants