324

Since I use Maven I have been able to build and install in my local repository projects that have incomplete Javadoc tags (for example, a missing parameter).

However, since I migrated to Java 8 (1.8.0-ea-b90) Maven is absolutely strict about missing documentation tags and show me lots of Javadoc errors related to Javadoc problems when I try to build or install a project where the Javadoc is not "perfect". Some of the projects I am trying to compile and install in my local repository are third party projects from which I do not have control. So the workaround of just fixing all the Javadocs in all these projects does not seem to be feasable in my scenario.

This is a small part of the output I see when I execute mvn clean package install in my project:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.026s
[INFO] Finished at: Mon Apr 08 21:06:17 CEST 2013
[INFO] Final Memory: 27M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9:jar (attach-javadocs) on project jpc: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /Users/sergioc/Documents/workspaces/heal/jpc/src/main/java/org/jpc/engine/prolog/PrologDatabase.java:10: error: @param name not found
[ERROR] * @param terms the terms to assert
[ERROR] ^
[ERROR] /Users/sergioc/Documents/workspaces/heal/jpc/src/main/java/org/jpc/engine/prolog/PrologDatabase.java:11: warning: no description for @return
[ERROR] * @return
[ERROR] ^

The Javadoc Maven plugin is configured like this in my POM:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

As I said before, everything is working fine if I go back to Java 7. Maybe is this a bug related to Maven running in Java 8? How could I make it work (i.e., being able to build the Javadoc of the project and install its code in my local repository) with Java 8? I have tested with both Maven 3.0.3 and 3.0.5 in OSX.

UPDATE:

If I change my Javadoc plugin configuration with <failOnError>false</failOnError> (thanks Martin):

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Then the project is installed in my local repository. However, the Javadoc JAR is still not generated.

A fragment of the output I see in the console with this new configuration is:

[ERROR] MavenReportException: Error while creating archive: Exit code: 1 - /Users/....java:18: warning: no @param ... Command line was: /Library/Java/Home/bin/javadoc @options @packages

Refer to the generated Javadoc files in '/Users/sergioc/Documents/workspaces/heal/minitoolbox/target/apidocs' dir.

at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeJavadocCommandLine(AbstractJavadocMojo.java:5043) at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1990) at org.apache.maven.plugin.javadoc.JavadocJar.execute(JavadocJar.java:181) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:491) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Any workaround about how to build the sources, install the project and generate the Javadoc JAR in one step as it was working with Java 7?

dur
  • 13,039
  • 20
  • 66
  • 96
Sergio
  • 8,032
  • 11
  • 45
  • 87
  • Hi @75inchpianist, I have updated the question, in fact they are errors (although surprisingly enough the last line of the error refers to a warning, as you can see in the generated output). The project is not installed in my local repository, so it is not considered as a simple warning :( – Sergio Apr 08 '13 at 19:16
  • For GoogleJuice: I got the error "error: bad use of '>'" because I had a big arrow in JavaDoc comment – Drew Stephens Feb 18 '14 at 18:30
  • 1
    Maybe it will be useful for someone: You can easily find all this incomplete tags in IntelliJ by running inspection Ctrl+Alt+Shift+i "Declaration has JavaDoc problems" – Sergey Ponomarev Aug 11 '15 at 16:38
  • 1
    This is not maven, it is the javadoc program which got a lot stricter in Java 8. – Thorbjørn Ravn Andersen Nov 01 '17 at 00:11

18 Answers18

398

The best solution would be to fix the javadoc errors. If for some reason that is not possible (ie: auto generated source code) then you can disable this check.

DocLint is a new feature in Java 8, which is summarized as:

Provide a means to detect errors in Javadoc comments early in the development cycle and in a way that is easily linked back to the source code.

This is enabled by default, and will run a whole lot of checks before generating Javadocs. You need to turn this off for Java 8 as specified in this thread. You'll have to add this to your maven configuration:

<profiles>
  <profile>
    <id>java8-doclint-disabled</id>
    <activation>
      <jdk>[1.8,)</jdk>
    </activation>
    <properties>
      <javadoc.opts>-Xdoclint:none</javadoc.opts>
    </properties>
  </profile>
</profiles>
<build>
  <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9</version>
        <executions>
            <execution>
                <id>attach-javadocs</id>
                <goals>
                    <goal>jar</goal>
                </goals>
                <configuration>
                    <additionalparam>${javadoc.opts}</additionalparam>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <reportPlugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <configuration>
                <additionalparam>${javadoc.opts}</additionalparam>
              </configuration>
            </plugin>
          </reportPlugins>
        </configuration>
      </plugin>
   </plugins>
</build>

For maven-javadoc-plugin 3.0.0+: Replace

<additionalparam>-Xdoclint:none</additionalparam>

with

<doclint>none</doclint>
Jasper de Vries
  • 13,693
  • 6
  • 54
  • 86
Subhas
  • 13,845
  • 1
  • 27
  • 36
  • 19
    Is there a way to make this work with JDK 8 _as well as_ JDK 7? It fails on JDK 7 because its `javadoc` doesn't know this option. – Feuermurmel Feb 11 '14 at 10:18
  • BTW, Xdoclint parameter can be configured more flexible. E.g. to disable annoying HTML checks just use `-Xdoclint:-html` – turbanoff Nov 11 '15 at 23:37
  • This doesn't work for me unfortunately (Java 1.8, maven 3.0.5) Any ideas why? – user16655 Dec 18 '15 at 09:06
  • 9
    While this answers the question asked here, I'd like to advise future visitors to check peterh's answer first: http://stackoverflow.com/a/34809831/1180785 (most people hitting this issue will only have a handful of places to fix, so it's better to fix them than disable the check!) – Dave Apr 12 '16 at 18:54
  • This does not work with maven-javadoc-plugin version 3.0.0. I had to go back to version 3.0.0-M1 for making -Xdoclint:none work. – Mehrad Sadegh Dec 11 '17 at 03:57
  • 8
    For maven-javadoc-plugin, use `none`. See https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#doclint – t7tran Dec 19 '17 at 11:58
  • 11
    Also since maven-javadoc-plugin 3.0.0, `` is replaced by ``. See https://issues.apache.org/jira/browse/MJAVADOC-475 – fdelsert Dec 20 '17 at 08:54
  • 1
    That's correct. I would like to notify that during migration from maven 2 to maven 3, don't forget that this plugin tag should not be included to reporting tag but directly to pluginManagement (pom.xml) – dimeros Nov 15 '18 at 10:27
  • By "configuration", what do you mean excatly? *Really* helps to be specific about steps to apply fixes. Please don't assume some noob or someone focused on a different layer knows much about some sub-invocation and how it's configured. To save time, could someone mention anything about how to quickly locate the maven configuration on macOS, Linux ...? On Debian Linux running `dpkg -L maven` implies `/etc/maven/settings`. And running: `find . -name "*plugin*"` in `/usr/share/maven` (also listed in `dpkg -L output`) shows. `./lib/maven-plugin-api-3.x.jar` – clearlight Feb 03 '19 at 14:34
98

The easiest approach to get things working with both java 8 and java 7 is to use a profile in the build:

<profiles>
  <profile>
    <id>doclint-java8-disable</id>
    <activation>
      <jdk>[1.8,)</jdk>
    </activation>

    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <additionalparam>-Xdoclint:none</additionalparam>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>
John Oxley
  • 13,918
  • 17
  • 49
  • 76
ankon
  • 3,782
  • 24
  • 24
  • 1
    The best solution would probably be a Hybrid between your solution and the one Zapp provided bellow. If you leave it this way, the mvn site:site command will still be crashing. You should create a profile activated by the 1.8 jdk that sets a global property. – Max Nad Sep 11 '15 at 19:35
65

Here is the most concise way I am aware of to ignore doclint warnings regardless of java version used. There is no need to duplicate plugin configuration in multiple profiles with slight modifications.

<profiles>
  <profile>
    <id>doclint-java8-disable</id>
    <activation>
      <jdk>[1.8,)</jdk>
    </activation>
    <properties>
      <javadoc.opts>-Xdoclint:none</javadoc.opts>
    </properties>
  </profile>
</profiles>

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-javadoc-plugin</artifactId>
      <version>2.9.1</version>
      <executions>
        <execution>
          <id>attach-javadocs</id> <!-- The actual id should be apparent from maven output -->
          <configuration>
            <additionalparam>${javadoc.opts}</additionalparam>
          </configuration>
        </execution>
      </executions>
    </plugin>
    ...
  </plugins>
</build>

Tested on oracle/open jdk 6, 7, 8 and 11.

Oliver Gondža
  • 2,972
  • 3
  • 21
  • 45
42

The shortest solution that will work with any Java version:

<profiles>
    <profile>
        <id>disable-java8-doclint</id>
        <activation>
            <jdk>[1.8,)</jdk>
        </activation>
        <properties>
            <additionalparam>-Xdoclint:none</additionalparam>
        </properties>
    </profile>
</profiles>

Just add that to your POM and you're good to go.

This is basically @ankon's answer plus @zapp's answer.


For maven-javadoc-plugin 3.0.0 users:

Replace

<additionalparam>-Xdoclint:none</additionalparam>

by

<doclint>none</doclint>

Community
  • 1
  • 1
Fred Porciúncula
  • 7,466
  • 2
  • 36
  • 52
  • It is the best solution for me. It works for bots java 7 and java 8. But the way it work is a kind of magic :. How does this parameter "additionalParam" add to the plugin javadoc (and not to the others) – pdem Jan 28 '16 at 14:18
  • 1
    @pdem The additional parameter is added to Maven, not to the Javadoc plugin. This solution works whether you're explicitly using the plugin or not. – Fred Porciúncula Jan 28 '16 at 15:19
  • 3
    Since maven-javadoc-plugin 3.0.0, you have to add`-Xdoclint:none` or `none` property to your `` – Sergi Jan 26 '18 at 11:36
  • Yes, Adding JDK 8 related profile & setting none resolves the issue. It generates javadoc jar same as it was generating in JDK 7. Thanks. – Saurabhcdt Feb 13 '18 at 06:10
  • 1
    Can you clarify: with maven-javadoc-plugin 3.0.0 and above, if I simply specify `none` (with no JDK version-based activation), will it still fail on JDK less than 1.8, or does maven-javadoc-plugin automatically detect whether the `doclint` option is supported by the current version of Java? – Garret Wilson May 19 '18 at 17:38
38

Add into the global properties section in the pom file:

<project>
    ...
    <properties>
        <additionalparam>-Xdoclint:none</additionalparam>
    </properties>

The common solution provided here in the other answers (adding that property in the plugins section) did not work for some reason. Only by setting it globally I could build the javadoc jar successfully.

zapp
  • 1,463
  • 1
  • 14
  • 17
  • 1
    this is the only solution that worked for me. I read the answer here as well: http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html – acvcu Sep 28 '15 at 18:01
32

I don't think just turning off DocLint is a good solution, at least not long term. It is good that Javadoc has become a bit more strict so the right way to fix the build problem is to fix the underlying problem. Yes, you'll ultimately need to fix those source code files.

Here are the things to look out for that you could previously get away with:

  • Malformed HTML (for example a missing end-tag, un-escaped brackets, etc)
  • Invalid {@link }s. (same goes for similar tags such as @see)
  • Invalid @author values. This used to be accepted : @author John <john.doe@mine.com> but not so anymore because of the un-escaped brackets.
  • HTML tables in Javadoc now require a summary or caption. See this question for explanation.

You'll simply have to fix your source code files and keep building your Javadoc until it can build without a failure. Cumbersome yes, but personally I like when I have brought my projects up to DocLint level because it means I can be more confident that the Javadoc I produce is actually what I intend.

There's of course the problem if you are generating Javadoc on some source code you've not produced yourself, for example because it comes from some code generator, e.g. wsimport. Strange that Oracle didn't prepare their own tools for JDK8 compliance before actually releasing JDK8. It seems it won't be fixed until Java 9. Only in this particular case I suggest to turn off DocLint as documented elsewhere on this page.

Community
  • 1
  • 1
peterh
  • 15,903
  • 9
  • 69
  • 93
  • 1
    Completely agree here, that said, for generated code you can simply tell the plugin to not process code in a given package by adding a excludePackageNames section in the javadoc plugin`s configuration section. see https://maven.apache.org/plugins/maven-javadoc-plugin/examples/exclude-package-names.html – Newtopian Aug 11 '16 at 19:47
  • @Newtopian. Good point. However in my case I actually needed the generated code from `wsimport` to become part of the Javadoc. – peterh Aug 14 '16 at 10:08
  • 1
    That's SO much easier said than done since a lot of us running into these problems are trying to build unfamiliar opensource code that has a Maven dependency somewhere and we have no idea how it all works, so have no easy way to address the underlying causes. There's too much myopia about the context. People need to generalize the scope of the answers more and provide more specifics about how to make the fixes. – clearlight Feb 03 '19 at 14:56
31

Overriding maven-javadoc-plugin configuration only, does not fix the problem with mvn site (used e.g during the release stage). Here's what I had to do:

<profile>
  <id>doclint-java8-disable</id>
  <activation>
    <jdk>[1.8,)</jdk>
  </activation>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <additionalparam>-Xdoclint:none</additionalparam>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <reportPlugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <configuration>
                <additionalparam>-Xdoclint:none</additionalparam>
              </configuration>
            </plugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>
Jakub Skoczen
  • 336
  • 3
  • 2
  • 3
    This is an important point as the lack of this setting in the site-plugin activation will cause release:perform to fail while release:prepare has worked fine. It can be a very annoying problem to find and fix. – Peter N. Steinmetz Aug 11 '15 at 16:32
  • Note, that the configuration of the `maven-javadoc-plugin` via the `` section of the `maven-site-plugin` is [not recommended](https://maven.apache.org/plugins/maven-site-plugin/maven-3.html#Configuration_formats) for recent versions of Maven 3. – Martin Höller Jan 25 '16 at 13:47
  • @MartinHöller So how to solve errors on release:perform stage related to mavene-javadoc-plugin:3.0.1 in proper way? – Vitalii Diravka Dec 14 '18 at 11:01
  • @VitaliiDiravka Depends on the errors... Please ask a separate question for this. – Martin Höller Dec 17 '18 at 07:39
25

You could try setting the failOnError property (see plugin documentation) to false:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>jar</goal>
            </goals>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
        </execution>
    </executions>
</plugin>

As you can see from the docs, the default value is true.

Martin Ellis
  • 9,263
  • 39
  • 53
  • Thanks for the idea @Martin. With that property at least I can build and install the project again, however I am still missing the java doc jar (I need it to deploy to Maven central). I updated my question with the details of the experiment. – Sergio May 22 '13 at 20:35
  • This was the most sufficient answer for me. I just wanted to test building during ongoing development when javadocs were still incomplete. – ZachSand May 05 '20 at 18:24
18

Since it depends on the version of your JRE which is used to run the maven command you propably dont want to disable DocLint per default in your pom.xml

Hence, from command line you can use the switch -Dadditionalparam=-Xdoclint:none.

Example: mvn clean install -Dadditionalparam=-Xdoclint:none

My-Name-Is
  • 4,474
  • 10
  • 39
  • 80
  • 3
    This is particularly useful because you can use it Jenkins too. Set 'Global MAVEN_OPTS' (under 'Configure System') to `-Dadditionalparam=-Xdoclint:none` and all your builds will work with Java 8. – Wilfred Hughes Jul 31 '17 at 13:50
  • `mvn org.apache.maven.plugins:maven-javadoc-plugin:3.1.0:jar -DadditionalJOption=-Xdoclint:none` - it worked for me – Roman Khomyshynets Apr 09 '19 at 12:16
10

The configuration property name has been changed in the latest version of maven-javadoc-plugin which is 3.0.0.

Hence the <additionalparam> will not work. So we have to modify it as below.

   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-javadoc-plugin</artifactId>
      <version>3.0.0</version>
      <configuration>
         <doclint>none</doclint>
      </configuration>
  </plugin>
Balachandar
  • 374
  • 4
  • 8
  • See `doclint` documentation here: http://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#doclint – Peter W Jul 02 '18 at 21:26
  • Resolved it for me building OpenGrok from github source in Feb'19. Should mention your patch goes into `pom.xml` in project's src/build directory. In my case all I had to do was search for `maven-javadoc-plugin` and then go to the `` block already present and add `none`. As easy as all of this is once one knows, the context here is I'm trying to fix a different bug in OpenGrok and have never used Maven before and don't want to have to recurse into another sub project just to have to figure out how to apply quick fixes. – clearlight Feb 03 '19 at 15:04
4

I would like to add some insight into other answers

In my case

-Xdoclint:none

Didn't work.

Let start with that, in my project, I didn't really need javadoc at all. Only some necessary plugins had got a build time dependency on it.

So, the most simple way solve my problem was:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>
mpasko256
  • 722
  • 12
  • 26
4

As of maven-javadoc-plugin 3.0.0 you should have been using additionalJOption to set an additional Javadoc option, so if you would like Javadoc to disable doclint, you should add the following property.

<properties>
    ...
    <additionalJOption>-Xdoclint:none</additionalJOption>
    ...
<properties>

You should also mention the version of maven-javadoc-plugin as 3.0.0 or higher.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>3.0.0</version>    
</plugin>
amanzoor
  • 359
  • 3
  • 6
3

Added below

JAVA_TOOL_OPTIONS=-DadditionalJOption=-Xdoclint:none

Into Jenkins job :

Configuration > Build Environment > Inject environment variables to the build process > Properties Content

Solved my problem of code building through Jenkins Maven :-)

Yann
  • 163
  • 1
  • 2
  • 9
snj
  • 41
  • 2
  • This works for maven-javadoc-plugin 2.4 but starting in 2.5 (and all the way through 3.0.0), this causes an error: "Exit code: 1 - javadoc: error - invalid flag: -Xdoclint:none". So the solution is brittle. – Akom May 23 '18 at 20:21
  • 1
    When using this with ```mvn release:perform``` the syntax needs to be ```mvn release:perform -Darguments="-Dmaven.javadoc.skip=true"```. – PatS Sep 28 '18 at 01:47
3

So, save yourself some hours that I didn't and try this if it seems not to work:

 <additionalJOption>-Xdoclint:none</additionalJOption>

The tag is changed for newer versions.

  • https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#additionalJOption – Thorsten Schöning Nov 20 '18 at 17:41
  • Sometimes `-Xdoclint` itself is not enough, but additional args are needed. Newer versions of the `maven-javadoc-plugin` provide `additionalJOptions` for that, older don't. A workaround is: `"-Xdoclint:none" "--allow-script-in-comments"` Quotes are important, else the plugin adds them and assumes only one arg instead of two, resulting in `wrong args` errors. – Thorsten Schöning Nov 20 '18 at 18:22
  • The former works on Windows only, on Linux instead: `javadoc: error - Illegal package name: ""-Xdoclint:none" "--allow-script-in-comments""` The outer quotes are added by the logging statement and not present on the shell. I guess the problem is that on Windows `javadoc` is executed by `cmd.exe`, which parses one large string as command line and splits the `additionalJOption`as intended. On Linux the args are passed individually to the process directly and `additionalJOption` gets passed as one argument, leading to the error. – Thorsten Schöning Jan 11 '19 at 17:41
  • According to `Process Monitor`, `cmd.exe` is not used. Java most likely simply builds one large command line and passes that to `CreateProcess`, so that it gets parsed by Windows as intended: Splitting args at spaces while honouring quotes. – Thorsten Schöning Jan 11 '19 at 18:25
2

I'm not sure if this is going to help, but even i faced the exact same problem very recently with oozie-4.2.0 version. After reading through the above answers i have just added the maven option through command line and it worked for me. So, just sharing here.

I'm using java 1.8.0_77, haven't tried with java 1.7

bin/mkdistro.sh -DskipTests -Dmaven.javadoc.opts='-Xdoclint:-html'

1

To ignore missing @param and @return tags, it's enough to disable the missing doclint group. This way, the javadoc will still be checked for higher level and syntax issues:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
            <doclint>all,-missing</doclint>
        </configuration>
    </plugin>

Note that this is for plugin version 3.0 or newer.

gjoranv
  • 3,063
  • 1
  • 12
  • 28
0

I'm a bit late to the party, but I was forced to search for workaround too, ended up here, and then found it.

Here's what works for me:-

export JAVA_TOOL_OPTIONS=-DadditionalJOption=-Xdoclint:none

And then start your Maven build, any Linux distribution build etc. Nice thing about it that it doesn't require Maven config files modification - I couldn't do that as my objective was to rebuild a bunch of Centos rpm packages, so had to go really deep.

antzshrek
  • 6,622
  • 5
  • 25
  • 40
0

In my case I was using a parent pom (not sure it was the real cause since I was running against the clock), maven 2.x and java 1.6 were used, for some reason above solutions didn't work, so I added the following profile and managed it to make it run:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>myapp</artifactId>
    <packaging>war</packaging>
    <name>myapp</name>
    <version>0.0.1-SNAPSHOT</version>
    <description>My App</description>
    <parent>
        <groupId>com.mycompany</groupId>
        <artifactId>parent-artifact</artifactId>
        <version>0.0.1</version>
    </parent>

    <profiles>
        <profile>
            <id>doclint-java6-disable</id>
            <activation>
                <jdk>[1.6,)</jdk>
            </activation>
            <properties>
                <additionalparam>--allow-script-in-comments</additionalparam>
            </properties>
        </profile>
    </profiles>
</project>
darkstar_mx
  • 346
  • 2
  • 7
  • Update: according to this issue: https://issues.apache.org/jira/browse/MNG-6871, it should work in Java version lower than JDK 8 update release 1.8.0_u121, otherwise it would complain you passed an unrecognized flag. – darkstar_mx Nov 11 '20 at 17:55