Mavenreportexception error while generating javadoc

I tried to build the code (mvn package) so I could use the "all-in-one" JAR file to run the tests locally but I got the following errors: [INFO] ------------------------------------------...

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

Assignees

@dstenger

@lgoltz

Comments

@heidivanparys

I tried to build the code (mvn package) so I could use the «all-in-one» JAR file to run the tests locally but I got the following errors:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:03 min
[INFO] Finished at: 2020-03-26T21:50:48+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:jar (site-package) on project ets-ogcapi-features10: Error generating maven-javadoc-plugin:2.10.4:javadoc report:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
[ERROR] C:UsersB004114DocumentsGitHubheidivanparysets-ogcapi-features10srcmainjavaorgopengisciteogcapifeatures10utilJsonUtils.java:215: warning: no @param for rels
[ERROR]     public static List<String> findLinksWithoutRelOrType( List<Map<String, Object>> links, Set<String> rels ) {
[ERROR]                                ^
[ERROR]
[ERROR] Command line was: C:OtherProgramsAdoptOpenJDKx64_11.0.2_9jdk-11.0.2+9binjavadoc.exe @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in 'C:UsersB004114DocumentsGitHubheidivanparysets-ogcapi-features10targetsiteapidocs' dir.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Updating the javadoc for method JsonUtils.findLinksWithoutRelOrType() resolves one issue, but the build still fails:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:46 min
[INFO] Finished at: 2020-03-26T21:55:32+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project ets-ogcapi-features10: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
[ERROR]
[ERROR] Command line was: C:OtherProgramsAdoptOpenJDKx64_11.0.2_9jdk-11.0.2+9binjavadoc.exe @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in 'C:UsersB004114DocumentsGitHubheidivanparysets-ogcapi-features10targetapidocs' dir.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@dstenger

Thank you for reporting.
@keshav-nangare Can you please take a look at this problem?

@keshavnangare

@heidivanparys



Copy link


Contributor

Author

Thanks for sorting this out.

I checked the documentation for the maven-javadoc-plugin, and the source can also be set using a user property.

image

So instead of updating pom.xml, the code can be built using mvn package -Dsource=8. Could this workaround be added to how-to-run-the-tests.adoc?

Note: mvn package -Dsource=1.8 seems to work as well, although the use of «1.8» is not documented in the javac --help output:

[...]
--release <release>
        Compile for a specific VM version. Supported targets: 6, 7, 8, 9, 10, 11
  -s <directory>               Specify where to place generated source files
  -source <release>
        Provide source compatibility with specified release
[...]

@dstenger

Nevertheless, we can also update the pom file.
@keshav-nangare Can you please create a pull request?

@keshavnangare

CITE
automation

moved this from To verify
to Done

Oct 8, 2020

Я пытаюсь запустить команду maven verify, но получаю эту ошибку.

MavenReportException: Error while generating Javadoc: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set.

Maven не может найти команду javadoc, поэтому не может создать документацию.

Интересно то, что я могу запустить команду mvn javadoc:jar, и она успешно работает. Кроме того, мой JAVA_HOME указывает на правильное место.

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home

Это из pom файла.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>3.0.0-M1</version>
    <configuration>
        <additionalparam>-Xdoclint:none</additionalparam>
    </configuration>
    <executions>
        <execution>
              <id>attach-javadoc</id>
              <phase>verify</phase>
              <goals>
                 <goal>jar</goal>
              </goals>
        </execution>
    </executions>
</plugin>

Пожалуйста, не говорите мне, что это дубликат вопроса Невозможно найти команду javadoc — maven. Я знаю, что проблема та же, но наши ситуации разные, и мой JAVA_HOME указывает правильное место. Так что это решение не работает для меня.


Ответы
2

У меня была такая же проблема с java 9.0.4 и macOs, и добавление следующей конфигурации в плагин javadoc решило ее для меня

  <configuration>
     .....
     <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
  </configuration>

Для версий JDK 1.8, 9, 11, 12, 14, 15, 16, 17:

<build>
    <plugins>
        <!-- ... -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <!--<version>3.2.0</version>-->
            <configuration>
                <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                <!--<doclint>none</doclint>-->
            </configuration>
        </plugin>
        <!-- ... -->
    </plugins>
</build>

Другие вопросы по теме


  • Type:


    Bug

  • Status:

    Closed


  • Priority:


    Major

  • Resolution:

    Fixed


  • Affects Version/s:



    2.10.4


  • Environment:

    macOS 10.12.5 build 175

    $java -version
    java version «9»
    Java(TM) SE Runtime Environment (build 9+175)
    Java HotSpot(TM) 64-Bit Server VM (build 9+175, mixed mode)

Javadoc generation fails for Jigsaw modules that depends on other Jigsaw modules:

module c {
  requires a;
  requires b;
}

while javadoc generation succeeds for modules a and b which have no module dependencies javadoc generation fails for module c which has module dependencies

MavenReportException: Error while generating Javadoc: 
[ERROR] Exit code: 1 - /Users/user/git/jigsaw/src/main/java/module-info.java:3: error: module not found: a
[ERROR]   requires a;
[ERROR]                                ^
[ERROR] /Users/user/git/jigsaw/src/main/java/module-info.java:4: error: module not found: b
[ERROR]   requires b;
[ERROR]                                ^
[ERROR] 
[ERROR] Command line was: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/javadoc @options @packages @argfile
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/Users/user/git/jigsaw/target/apidocs' dir.

The issue seems to be that the javadoc plugin only ever sets classpath. The javadoc plugin would have to set -module-path like the compiler plugin does.

Понравилась статья? Поделить с друзьями:
  • Mats error code 00000003
  • Mats error code 000000000229
  • Mats error code 000000000220
  • Maximum permissible error
  • Mats 33 ошибки